Index: includes/theme.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/theme.inc,v
retrieving revision 1.504
diff -u -p -r1.504 theme.inc
--- includes/theme.inc 13 Aug 2009 03:05:54 -0000 1.504
+++ includes/theme.inc 15 Aug 2009 17:53:54 -0000
@@ -1264,17 +1264,37 @@ function theme_status_messages($display
* - href: the link URL. If omitted, the 'title' is shown as a plain text item in the links list.
* - html: (optional) set this to TRUE if 'title' is HTML so it will be escaped.
* Array items are passed on to the l() function's $options parameter when creating the link.
+ * @param $heading
+ * An optional keyed array for a heading to precede the links:
+ * - text: the heading text
+ * - level: the heading level (e.g. 'h2', 'h3')
+ * - class: (optional) space-separated classes for the heading
+ * Headings should be used on navigation menus and any list of links that
+ * consistently appears on multiple pages. To make the heading invisible
+ * use class => 'element-invisible'. Do not use 'display:none', which
+ * removes it from screen-readers and assistive technology. Headings allow
+ * screen-reader and keyboard only users to navigate to or skip the links.
+ * See http://juicystudio.com/article/screen-readers-display-none.php
+ * and http://www.w3.org/TR/WCAG-TECHS/H42.html for more information.
* @param $attributes
* A keyed array of attributes.
* @return
* A string containing an unordered list of links.
*/
-function theme_links($links, $attributes = array('class' => 'links')) {
+function theme_links($links, $heading = array(), $attributes = array('class' => 'links')) {
global $language;
$output = '';
if (count($links) > 0) {
- $output = '
';
+ $output = '';
+ if (!empty($heading['text']) && !empty($heading['level'])) {
+ $output .= '<' . $heading['level'] . (!empty($heading['class']) ?
+ drupal_attributes(array('class' => $heading['class'])) : '') . '>';
+ $output .= check_plain($heading['text']);
+ $output .= '' . $heading['level'] . '>';
+ }
+
+ $output .= '';
$num_links = count($links);
$i = 1;
Index: modules/system/page.tpl.php
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/page.tpl.php,v
retrieving revision 1.27
diff -u -p -r1.27 page.tpl.php
--- modules/system/page.tpl.php 3 Aug 2009 03:04:33 -0000 1.27
+++ modules/system/page.tpl.php 15 Aug 2009 17:53:55 -0000
@@ -154,7 +154,7 @@
- 'main-menu', 'class' => 'links clearfix')); ?>
+ t('Main menu'), 'level' => 'h2'), array('id' => 'main-menu', 'class' => 'links clearfix')); ?>
@@ -192,7 +192,7 @@
Index: themes/garland/template.php
===================================================================
RCS file: /cvs/drupal/drupal/themes/garland/template.php,v
retrieving revision 1.23
diff -u -p -r1.23 template.php
--- themes/garland/template.php 28 Jul 2009 10:09:25 -0000 1.23
+++ themes/garland/template.php 15 Aug 2009 17:53:55 -0000
@@ -19,8 +19,12 @@ function garland_breadcrumb($breadcrumb)
*/
function garland_preprocess_page(&$vars) {
$vars['tabs2'] = menu_secondary_local_tasks();
- $vars['primary_nav'] = isset($vars['main_menu']) ? theme('links', $vars['main_menu'], array('class' => 'links main-menu')) : FALSE;
- $vars['secondary_nav'] = isset($vars['secondary_menu']) ? theme('links', $vars['secondary_menu'], array('class' => 'links secondary-menu')) : FALSE;
+ $vars['primary_nav'] = isset($vars['main_menu']) ? theme('links', $vars['main_menu'], array(
+ 'text' => t('Main menu'), 'level' => 'h2', 'class' => 'element-invisible',
+ ), array('class' => 'links main-menu')) : FALSE;
+ $vars['secondary_nav'] = isset($vars['secondary_menu']) ? theme('links', $vars['secondary_menu'], array(
+ 'text' => t('Secondary menu'), 'level' => 'h2', 'class' => 'element-invisible',
+ ), array('class' => 'links secondary-menu')) : FALSE;
$vars['ie_styles'] = garland_get_ie_styles();
// Prepare header