diff --git a/core/misc/vertical-tabs-rtl.css b/core/misc/vertical-tabs-rtl.css index 7fb0347..32f1c7e 100644 --- a/core/misc/vertical-tabs-rtl.css +++ b/core/misc/vertical-tabs-rtl.css @@ -1,14 +1,14 @@ +@media (min-width: 640px) { + div.vertical-tabs { + margin: 1em 15em 1em 0; + } -div.vertical-tabs { - margin-left: 0; - margin-right: 15em; -} -.vertical-tabs ul.vertical-tabs-list { - margin-left: 0; - margin-right: -15em; - float: right; -} -.vertical-tabs ul.vertical-tabs-list li.selected { - border-left-width: 0; - border-right-width: 1px; + .vertical-tabs ul.vertical-tabs-list { + margin: -1px -15em -1px 0; + float: right; + } + + .vertical-tab-widget.selected { + border-width: 0 1px 1px 0; + } } diff --git a/core/misc/vertical-tabs.css b/core/misc/vertical-tabs.css index c946503..c307619 100644 --- a/core/misc/vertical-tabs.css +++ b/core/misc/vertical-tabs.css @@ -1,57 +1,73 @@ - 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-tab-hidden { + 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; /* prevent 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-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 */ } -.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; } @@ -67,3 +83,32 @@ fieldset.vertical-tabs-pane > legend { -webkit-box-sizing: border-box; box-sizing: border-box; } + +@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; + } + + .vertical-tab-widget.selected { + border-width: 0 0 1px 1px; /* LTR */ + } +} + diff --git a/core/misc/vertical-tabs.js b/core/misc/vertical-tabs.js index 65e5683..2114cdd 100644 --- a/core/misc/vertical-tabs.js +++ b/core/misc/vertical-tabs.js @@ -5,6 +5,14 @@ * tabs. Another tab pane can be selected by clicking on the respective * tab. * + * To allow the tabbed interface to expand from a single column to two columns + * (tabs and panes separate) when screen space is available, this script + * generates two tab widgets per pane: one to replace the fieldset legend + * ("innerWidget"), and one to exist in an unordered list external to the + * fieldsets ("outerWidget"). The necessity of doing this could be obviated + * if a method were found to display both layouts with only one of the sets of + * tab widgets. + * * Each tab may have a summary which can be updated by another * script. For that to work, each fieldset has an associated * 'verticalTabCallback' (with jQuery.data() attached to the fieldset), @@ -14,39 +22,59 @@ Drupal.behaviors.verticalTabs = { attach: function (context) { $(context).find('.vertical-tabs-panes').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 $this = $(this); var focusID = $this.find(':hidden.vertical-tabs-active-tab').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 = $this.find('> fieldset'); if ($fieldsets.length == 0) { return; } - // Create the tab column. + // Prepare a