diff --git a/core/misc/vertical-tabs.css b/core/misc/vertical-tabs.css index c946503..b86532d 100644 --- a/core/misc/vertical-tabs.css +++ b/core/misc/vertical-tabs.css @@ -1,61 +1,100 @@ - div.vertical-tabs { - margin: 1em 0 1em 15em; /* LTR */ + margin: 1em 0; border: 1px solid #ccc; } + .vertical-tabs ul.vertical-tabs-list { - width: 15em; - list-style: none; - border-top: 1px solid #ccc; - padding: 0; - margin: -1px 0 -1px -15em; /* LTR */ - float: left; /* LTR */ + display: none; } + .vertical-tabs fieldset.vertical-tabs-pane { margin: 0 !important; - padding: 0 1em; + padding: 0; border: 0; } + fieldset.vertical-tabs-pane > legend { - display: none; + /* Save the legend from shrinkwrapping. */ + box-sizing: border-box; + width: 100%; + margin: 0; +} + +.vertical-tabs fieldset.vertical-tabs-pane > div.fieldset-contents { + padding: 0 1em; + overflow: hidden; /* stop margin collapse */ } -/* Layout of each tab */ -.vertical-tabs ul.vertical-tabs-list li { +.vertical-tab-widget { background: #eee; - border: 1px solid #ccc; - border-top: 0; + border-style: solid; + border-color: #ccc; + border-width: 1px 0 0; padding: 0; margin: 0; } -.vertical-tabs ul.vertical-tabs-list li a { + +legend.vertical-tab-widget.first { + border-top-width: 0; +} + +.vertical-tab-widget a { display: block; text-decoration: none; padding: 0.5em 0.6em; } -.vertical-tabs ul.vertical-tabs-list li a:focus strong, -.vertical-tabs ul.vertical-tabs-list li a:active strong, -.vertical-tabs ul.vertical-tabs-list li a:hover strong { + +.vertical-tab-widget a:focus strong, +.vertical-tab-widget a:active strong, +.vertical-tab-widget a:hover strong { text-decoration: underline; } -.vertical-tabs ul.vertical-tabs-list li a:hover { + +.vertical-tab-widget a:hover { outline: 1px dotted; } -.vertical-tabs ul.vertical-tabs-list li.selected { +.vertical-tab-widget.selected { background-color: #fff; - border-right-width: 0; /* LTR */ + border-bottom-width: 0; } -.vertical-tabs ul.vertical-tabs-list .selected strong { +.vertical-tab-widget.selected strong { color: #000; } -.vertical-tabs ul.vertical-tabs-list .summary { +.vertical-tab-widget .summary { display: block; -} -.vertical-tabs ul.vertical-tabs ul.vertical-tabs-list .summary { line-height: normal; margin-bottom: 0; } + +@media (min-width: 640px) { + div.vertical-tabs { + margin: 1em 0 1em 15em; /* LTR */ + } + + .vertical-tabs ul.vertical-tabs-list { + display: block; + width: 15em; + list-style: none; + border-top: 1px solid #ccc; + padding: 0; + margin: -1px 0 -1px -15em; /* LTR */ + float: left; /* LTR */ + } + + fieldset.vertical-tabs-pane > legend { + display: none; + } + + .vertical-tab-widget { + border-width: 0 1px 1px 1px; + } + + .vertical-tab-widget.selected { + border-width: 0 0 1px 1px; /* LTR */ + } +} + /** * Prevent text inputs from overflowing when container is too narrow. "width" is * applied to override hardcoded cols or size attributes and used in conjunction diff --git a/core/misc/vertical-tabs.js b/core/misc/vertical-tabs.js index 14d0660..f3ac064 100644 --- a/core/misc/vertical-tabs.js +++ b/core/misc/vertical-tabs.js @@ -15,26 +15,38 @@ Drupal.behaviors.verticalTabs = { attach: function (context) { $('.vertical-tabs-panes', context).once('vertical-tabs', function () { + // A hidden form element will indicate the ID of a pane that should be + // pre-selected, and tab_focus will be set to the corresponding jQuery + // object, if it exists, as we loop over the fieldsets. var focusID = $(':hidden.vertical-tabs-active-tab', this).val(); var tab_focus; - // Check if there are some fieldsets that can be converted to vertical-tabs + // Stop now if there aren't any fieldsets to be converted to tab panes. var $fieldsets = $('> fieldset', this); if ($fieldsets.length == 0) { return; } - // Create the tab column. + // Prepare a