Index: includes/form.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/form.inc,v
retrieving revision 1.406
diff -u -p -r1.406 form.inc
--- includes/form.inc 24 Nov 2009 21:56:15 -0000 1.406
+++ includes/form.inc 25 Nov 2009 09:51:46 -0000
@@ -2550,7 +2550,9 @@
// Add required JavaScript and Stylesheet.
drupal_add_library('system', 'vertical-tabs');
- return '
' . $element['#children'] . '
';
+ $output = '' . t('Vertical Tabs') . '
';
+ $output .= '' . $element['#children'] . '
';
+ return $output;
}
/**
Index: misc/vertical-tabs.css
===================================================================
RCS file: /cvs/drupal/drupal/misc/vertical-tabs.css,v
retrieving revision 1.6
diff -u -p -r1.6 vertical-tabs.css
--- misc/vertical-tabs.css 31 May 2009 00:51:41 -0000 1.6
+++ misc/vertical-tabs.css 23 Nov 2009 10:26:57 -0000
@@ -4,6 +4,15 @@
margin: 1em 0 1em 15em;
border: 1px solid #ccc;
}
+
+*:focus, *:active{
+ background-color: #FF9999 !important;
+ color: Yellow !important;
+ font-weight: bold;
+ outline: 3px red dotted;
+}
+
+
div.vertical-tabs ul.vertical-tabs-list {
width: 15em;
list-style: none;
@@ -40,27 +49,38 @@
line-height: 1.3em;
height: 1%;
}
-div.vertical-tabs ul.vertical-tabs-list li a:focus {
+
+div.vertical-tabs ul.vertical-tabs-list li a:focus, div.vertical-tabs ul.vertical-tabs-list li a:active {
+ background-color: Highlight;
+ color: HighlightText;
+ outline: 3px dotted;
position: relative;
z-index: 5;
}
+
div.vertical-tabs ul.vertical-tabs-list li a:hover {
+ background-color: Highlight;
+ color: HighlightText;
text-decoration: none;
}
+
div.vertical-tabs ul.vertical-tabs-list li.selected {
- background: #fff;
+ background-color: White;
border-right-width: 0;
+ outline: 1px solid;
position: relative;
}
+
div.vertical-tabs ul.vertical-tabs-list li.selected a:focus {
- outline: 0;
+ outline: 2px solid;
}
-div.vertical-tabs ul.vertical-tabs-list li.selected strong,
-div.vertical-tabs ul.vertical-tabs-list li.selected small {
+div.vertical-tabs ul.vertical-tabs-list span.selected strong {
color: #000;
}
div.vertical-tabs ul.vertical-tabs-list .summary {
display: block;
+ font-size: smaller;
+ padding-bottom: 0;
}
div.vertical-tabs ul.vertical-tabs ul.vertical-tabs-list .summary {
line-height: normal;
Index: misc/vertical-tabs.js
===================================================================
RCS file: /cvs/drupal/drupal/misc/vertical-tabs.js,v
retrieving revision 1.7
diff -u -p -r1.7 vertical-tabs.js
--- misc/vertical-tabs.js 31 Aug 2009 05:51:08 -0000 1.7
+++ misc/vertical-tabs.js 24 Nov 2009 21:31:14 -0000
@@ -17,31 +17,34 @@
attach: function (context) {
$('.vertical-tabs-panes', context).once('vertical-tabs', function () {
var focusID = $(':hidden.vertical-tabs-active-tab', this).val();
- var focus;
+ var tabfocus; // Refactoring names - too much "focus"
// Create the tab column.
- var list = $('');
- $(this).wrap('').before(list);
+ var tablist = $('');
+ $(this).wrap('').before(tablist);
// Transform each fieldset into a tab.
$('> fieldset', this).each(function () {
- var tab = new Drupal.verticalTab({ title: $('> legend', this).text(), fieldset: $(this) });
- list.append(tab.item);
+ var vtab = new Drupal.verticalTab({
+ title: $('> legend', this).text(),
+ fieldset: $(this)
+ });
+ tablist.append(vtab.item);
$(this)
.removeClass('collapsible collapsed')
.addClass('vertical-tabs-pane')
- .data('verticalTab', tab);
+ .data('verticalTab', vtab);
if (this.id == focusID) {
- focus = $(this);
+ tabfocus = $(this);
}
});
- $('> li:first', list).addClass('first');
- $('> li:last', list).addClass('last');
+ $('> li:first', tablist).addClass('first');
+ $('> li:last', tablist).addClass('last');
- if (!focus) {
- focus = $('> .vertical-tabs-pane:first', this);
+ if (!tabfocus) {
+ tabfocus = $('> .vertical-tabs-pane:first', this);
}
- focus.data('verticalTab').focus();
+ tabfocus.data('verticalTab').focus();
});
}
};
@@ -63,6 +66,29 @@
return false;
});
+ // Keyboard events added:
+ // Pressing the Enter key will open the tab pane
+ this.link.keydown(function(event) {
+ if (event.keyCode == 13) {
+ self.focus();
+ // Set focus on the first input field of the visible fieldset/tab pane
+ $("fieldset.vertical-tabs-pane :file").css({background:"yellow"});
+ $("fieldset.vertical-tabs-pane :input:visible:enabled:first").focus();
+ location.hash = "#edit-upload";
+ return false;
+ }
+ });
+
+ // Pressing the Enter key lets you leave the tab again
+ this.fieldset.keydown(function(event) {
+ // Enter key should not trigger inside