From 879a80c34da3eb7d705999a1df6b62261afda097 Mon Sep 17 00:00:00 2001 From: MatmaRex Date: Sat, 27 Oct 2012 20:34:15 +0200 Subject: [PATCH] (bug 457) use semantic headings for the navigation menu This changes the current scheme of using (varies per skin)

,

and/or
tags (with nothing apart from the main

above them in the hierarchy) to

above the entire navigation and

s as portlet headings. The

is hidden for normal browsers, but accessible for screen-readers or text browsers. Its content comes from a new message called "navigation-heading". The changes were applied to Vector, Monobook, Modern and CologneBlue. The change to Monobook also resulted in the heading appearing in Chick and MySkin (I intentionally didn't implement hiding it in these skins, as they are intended respectively as a super-lightweight one and a skim "template") and in Simple (where I did hide it, but didn't bother with further CSS fixups). Related changes and technical notes: * Monobook had various styles for apparently all heading levels inside of a .portlet, but only

s (now

s) could ever be generated. The styles were also ancient, straight from 2004 (I git-blamed), so I removed them, as they were almost certainly completely unused. * Modern lacked font-size for .portlet h5 (now h3). It worked mostly okay before (font-size of h5 is similar to size of regular text), but after headings were changed to

s, they became too large. I used font-size:0.83em (copied from Opera's user-agent stylesheet), but this might result in slight font-size changes on various browsers. * Vector's variant menu is deeply broken. I changed the bonkers structure to two

s, one with id=mw-vector-current-variant. This is still broken, but I don't really know how to do it properly. * In Vector's CSS, the height for div.vectorMenu h3 a (previously h5 a) had to be changed. I used 1.9em, the same as used for div.vectorTabs li a, but this probably shouldn't be measured in ems anyway. * CologneBlue and Vector lacked wrappers over the entire navigation; I added
to both of them. In CologneBlue this also required moving -quickBar() ?> +
+

escaped() ?>

+ + quickBar() ?> +
$data ) { $portletId = Sanitizer::escapeId( "p-$heading" ); $headingMsg = wfMessage( $idToMessage[$heading] ? $idToMessage[$heading] : $heading ); - $headingHTML = "
" . ( $headingMsg->exists() ? $headingMsg->escaped() : htmlspecialchars( $heading ) ) . "
"; + $headingHTML = "

" . ( $headingMsg->exists() ? $headingMsg->escaped() : htmlspecialchars( $heading ) ) . "

"; $listHTML = ""; if ( is_array( $data ) ) { diff --git a/skins/Modern.php b/skins/Modern.php index ce850a0be3..900bdd8974 100644 --- a/skins/Modern.php +++ b/skins/Modern.php @@ -106,6 +106,7 @@ class ModernTemplate extends MonoBookTemplate {
html("userlangattributes") ?>> +

msg( 'navigation-heading' ) ?>

renderPortals( $this->data['sidebar'] ); ?> @@ -119,7 +120,7 @@ class ModernTemplate extends MonoBookTemplate {
html('userlangattributes') ?>> +

msg( 'navigation-heading' ) ?>

cactions(); ?>

+ html('userlangattributes') ?>>msg('otherlanguages') ?>
    data['language_urls'] as $key => $langlink) { ?> @@ -299,7 +300,7 @@ echo $footerEnd; echo ' ' . Html::openElement( 'div', $portletAttribs ); ?> -
    exists() ? $msg->text() : $bar ); ?>
    +

    exists() ? $msg->text() : $bar ); ?>

      diff --git a/skins/Vector.php b/skins/Vector.php index 097bddea66..92eb3ad02f 100644 --- a/skins/Vector.php +++ b/skins/Vector.php @@ -227,25 +227,28 @@ class VectorTemplate extends BaseTemplate {
    - -
    - renderNavigation( 'PERSONAL' ); ?> -
    - renderNavigation( array( 'NAMESPACES', 'VARIANTS' ) ); ?> -
    -
    - renderNavigation( array( 'VIEWS', 'ACTIONS', 'SEARCH' ) ); ?> +
    +

    msg( 'navigation-heading' ) ?>

    + +
    + renderNavigation( 'PERSONAL' ); ?> +
    + renderNavigation( array( 'NAMESPACES', 'VARIANTS' ) ); ?> +
    +
    + renderNavigation( array( 'VIEWS', 'ACTIONS', 'SEARCH' ) ); ?> +
    -
    - - + +
    renderPortals( $this->data['sidebar'] ); ?>
    - + +