Index: includes/form.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/form.inc,v
retrieving revision 1.442
diff -u -p -r1.442 form.inc
--- includes/form.inc	13 Mar 2010 22:33:05 -0000	1.442
+++ includes/form.inc	18 Mar 2010 11:26:00 -0000
@@ -2655,7 +2655,9 @@
   // Add required JavaScript and Stylesheet.
   drupal_add_library('system', 'vertical-tabs');
 
-  return '<div class="vertical-tabs-panes">' . $element['#children'] . '</div>';
+  $output = '<h2 class="element-invisible">' . t('Vertical Tabs') . '</h2>';
+  $output .= '<div class="vertical-tabs-panes">' . $element['#children'] . '</div>';
+  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	18 Mar 2010 11:28:10 -0000
@@ -40,23 +40,25 @@
   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 strong,
+div.vertical-tabs ul.vertical-tabs-list li a:active strong,
+div.vertical-tabs ul.vertical-tabs-list li a:hover strong {
+  text-decoration: underline;
+}
+div.vertical-tabs ul.vertical-tabs-list li a:focus,
+div.vertical-tabs ul.vertical-tabs-list li a:active {
   position: relative;
   z-index: 5;
 }
 div.vertical-tabs ul.vertical-tabs-list li a:hover {
-  text-decoration: none;
+  outline: 1px dotted;
 }
 div.vertical-tabs ul.vertical-tabs-list li.selected {
-  background: #fff;
+  background-color: #fff;
   border-right-width: 0;
   position: relative;
 }
-div.vertical-tabs ul.vertical-tabs-list li.selected a:focus {
-  outline: 0;
-}
-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 {
Index: misc/vertical-tabs.js
===================================================================
RCS file: /cvs/drupal/drupal/misc/vertical-tabs.js,v
retrieving revision 1.10
diff -u -p -r1.10 vertical-tabs.js
--- misc/vertical-tabs.js	24 Mar 2010 10:19:38 -0000	1.10
+++ misc/vertical-tabs.js	24 Mar 2010 21:18:59 -0000
@@ -17,39 +17,42 @@
   attach: function (context) {
     $('.vertical-tabs-panes', context).once('vertical-tabs', function () {
       var focusID = $(':hidden.vertical-tabs-active-tab', this).val();
-      var focus;
-      
+      var tab_focus;
+
       // Check if there are some fieldsets that can be converted to vertical-tabs
       var $fieldsets = $('> fieldset', this);
       if ($fieldsets.length == 0) {
         return;
       }
-      
+
       // Create the tab column.
-      var list = $('<ul class="vertical-tabs-list"></ul>');
-      $(this).wrap('<div class="vertical-tabs clearfix"></div>').before(list);
+      var tab_list = $('<ul class="vertical-tabs-list"></ul>');
+      $(this).wrap('<div class="vertical-tabs clearfix"></div>').before(tab_list);
 
       // Transform each fieldset into a tab.
       $fieldsets.each(function () {
-        var tab = new Drupal.verticalTab({ title: $('> legend', this).text(), fieldset: $(this) });
-        list.append(tab.item);
+        var vertical_tab = new Drupal.verticalTab({
+          title: $('> legend', this).text(),
+          fieldset: $(this)
+        });
+        tab_list.append(vertical_tab.item);
         $(this)
           .removeClass('collapsible collapsed')
           .addClass('vertical-tabs-pane')
-          .data('verticalTab', tab);
+          .data('verticalTab', vertical_tab);
         if (this.id == focusID) {
-          focus = $(this);
+          tab_focus = $(this);
         }
       });
 
-      $('> li:first', list).addClass('first');
-      $('> li:last', list).addClass('last');
+      $('> li:first', tab_list).addClass('first');
+      $('> li:last', tab_list).addClass('last');
 
-      if (!focus) {
-        focus = $('> .vertical-tabs-pane:first', this);
+      if (!tab_focus) {
+        tab_focus = $('> .vertical-tabs-pane:first', this);
       }
-      if (focus.length) {
-        focus.data('verticalTab').focus();
+      if (tab_focus.length) {
+        tab_focus.data('verticalTab').focus();
       }
     });
   }
@@ -72,6 +75,27 @@
     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 :input:visible:enabled:first").focus();
+      return false;
+    }
+  });
+
+  // Pressing the Enter key lets you leave the tab again.
+  this.fieldset.keydown(function(event) {
+    // Enter key should not trigger inside <textarea> to allow for multi-line entries.
+    if (event.keyCode == 13 && event.target.nodeName != "TEXTAREA") {
+      // Set focus on the selected tab button again.
+      $(".vertical-tab-button.selected a").focus();
+      return false;
+    }
+  });
+
   this.fieldset
     .bind('summaryUpdated', function () {
       self.updateSummary();
@@ -96,6 +120,9 @@
       .siblings(':hidden.vertical-tabs-active-tab')
         .val(this.fieldset.attr('id'));
     this.item.addClass('selected');
+    // Mark the active tab for screen readers.
+    $('#active-vertical-tab').remove();
+    this.link.append('<span id="active-vertical-tab" class="element-invisible">' + Drupal.t('(active tab)') + '</span>');
   },
 
   /**
@@ -160,10 +187,10 @@
  */
 Drupal.theme.prototype.verticalTab = function (settings) {
   var tab = {};
-  tab.item = $('<li class="vertical-tab-button"></li>')
+  tab.item = $('<li class="vertical-tab-button" tabindex="-1"></li>')
     .append(tab.link = $('<a href="#"></a>')
       .append(tab.title = $('<strong></strong>').text(settings.title))
-      .append(tab.summary = $('<small class="summary"></small>')
+      .append(tab.summary = $('<span class="summary"></span>')
     )
   );
   return tab;

