r98045 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r98044‎ | r98045 | r98046 >
Date:00:49, 25 September 2011
Author:dantman
Status:resolved (Comments)
Tags:
Comment:
Improve the accessibility of our jump-to functionality
- Stop hiding with display: none;, this hides our jump links from modern screen readers and users with motor disabilities (ie: nowadays, pratically everyone they are intended to help).
- Instead hide with an overflow that will make the links viable <tab> targets. This alone is enough to help screen reader users.
- Add in a script that will show the jump-links area on-focus for motor-impared users who can still see who have js enabled (this can't be done with css unfortunately)
Modified paths:
  • /trunk/phase3/resources/Resources.php (modified) (history)
  • /trunk/phase3/resources/jquery/jquery.mw-jump.js (added) (history)
  • /trunk/phase3/skins/MonoBook.php (modified) (history)
  • /trunk/phase3/skins/Vector.php (modified) (history)
  • /trunk/phase3/skins/common/commonInterface.css (modified) (history)
  • /trunk/phase3/skins/common/commonPrint.css (modified) (history)
  • /trunk/phase3/skins/common/shared.css (modified) (history)

Diff [purge]

Index: trunk/phase3/resources/jquery/jquery.mw-jump.js
@@ -0,0 +1,15 @@
 2+/**
 3+ * JavaScript to show jump links to motor-impaired users when they are focused.
 4+ */
 5+jQuery( function( $ ) {
 6+
 7+ $('.mw-jump').delegate( 'a', 'focus blur', function( e ) {
 8+ // Confusingly jQuery leaves e.type as "focusout" for delegated blur events
 9+ if ( e.type === "blur" || e.type === "focusout" ) {
 10+ $( this ).closest( '.mw-jump' ).css({ height: '0' });
 11+ } else {
 12+ $( this ).closest( '.mw-jump' ).css({ height: 'auto' });
 13+ }
 14+ } );
 15+
 16+} );
Property changes on: trunk/phase3/resources/jquery/jquery.mw-jump.js
___________________________________________________________________
Added: svn:eol-style
117 + native
Index: trunk/phase3/resources/Resources.php
@@ -158,6 +158,9 @@
159159 'jquery.mwExtension' => array(
160160 'scripts' => 'resources/jquery/jquery.mwExtension.js',
161161 ),
 162+ 'jquery.mw-jump' => array(
 163+ 'scripts' => 'resources/jquery/jquery.mw-jump.js',
 164+ ),
162165 'jquery.qunit' => array(
163166 'scripts' => 'resources/jquery/jquery.qunit.js',
164167 'styles' => 'resources/jquery/jquery.qunit.css',
@@ -610,6 +613,7 @@
611614 'jquery.checkboxShiftClick',
612615 'jquery.makeCollapsible',
613616 'jquery.placeholder',
 617+ 'jquery.mw-jump',
614618 'mediawiki.util',
615619 ),
616620 ),
Index: trunk/phase3/skins/common/commonPrint.css
@@ -114,6 +114,7 @@
115115
116116 .noprint,
117117 div#jump-to-nav,
 118+.mw-jump,
118119 div.top,
119120 div#column-one,
120121 #colophon,
Index: trunk/phase3/skins/common/shared.css
@@ -1006,3 +1006,11 @@
10071007 #mw-credits a {
10081008 unicode-bidi: embed;
10091009 }
 1010+
 1011+/* Accessibility */
 1012+.mw-jump {
 1013+ overflow: hidden;
 1014+ height: 0;
 1015+ zoom: 1; /* http://webaim.org/techniques/skipnav/#iequirk */
 1016+}
 1017+
Index: trunk/phase3/skins/common/commonInterface.css
@@ -46,7 +46,9 @@
4747 display: none;
4848 }
4949 #jump-to-nav {
50 - display: none;
 50+ /* Negate #contentSub's margin and replicate it so that the jump to links don't affect the spacing */
 51+ margin-top: -1.4em;
 52+ margin-bottom: 1.4em
5153 }
5254 #contentSub, #contentSub2 {
5355 font-size: 84%;
Index: trunk/phase3/skins/Vector.php
@@ -158,7 +158,7 @@
159159 <?php endif; ?>
160160 <?php if ( $this->data['showjumplinks'] ): ?>
161161 <!-- jumpto -->
162 - <div id="jump-to-nav">
 162+ <div id="jump-to-nav" class="mw-jump">
163163 <?php $this->msg( 'jumpto' ) ?> <a href="#mw-head"><?php $this->msg( 'jumptonavigation' ) ?></a>,
164164 <a href="#p-search"><?php $this->msg( 'jumptosearch' ) ?></a>
165165 </div>
Index: trunk/phase3/skins/MonoBook.php
@@ -80,7 +80,7 @@
8181 <?php } ?><?php if($this->data['newtalk'] ) { ?>
8282 <div class="usermessage"><?php $this->html('newtalk') ?></div>
8383 <?php } ?><?php if($this->data['showjumplinks']) { ?>
84 - <div id="jump-to-nav"><?php $this->msg('jumpto') ?> <a href="#column-one"><?php $this->msg('jumptonavigation') ?></a>, <a href="#searchInput"><?php $this->msg('jumptosearch') ?></a></div>
 84+ <div id="jump-to-nav" class="mw-jump"><?php $this->msg('jumpto') ?> <a href="#column-one"><?php $this->msg('jumptonavigation') ?></a>, <a href="#searchInput"><?php $this->msg('jumptosearch') ?></a></div>
8585 <?php } ?>
8686 <!-- start content -->
8787 <?php $this->html('bodytext') ?>

Follow-up revisions

RevisionCommit summaryAuthorDate
r98047Followup r98045, release notes.dantman02:03, 25 September 2011
r112034Followup r98045: fix bug 34504 wrt "Jump to" links in cached pages showing un...brion19:25, 21 February 2012

Comments

#Comment by Hashar (talk | contribs)   11:10, 12 December 2011

I am confused. How can we get focus on mw-jump ? I can't manage to do that with Safari / Firefox.

#Comment by Dantman (talk | contribs)   18:08, 12 December 2011

You using OS X too?

Safari and Firefox are screwy on OS X. <tab> only tabs through form inputs and the browser chrome. Normally a browser tabs through all links.

Chrome isn't affected by this bug. If you go to System Preferences > Keyboard and then change the "Full Keyboard Access: ..." radio box to "All Controls" then Firefox will also work normally. For Safari you can use Option+Tab instead of just tab, or go into Preferences > Advanced and use the second "Universal Access" checkbox to swap the Option+Tab and Tab behaviors.

For focus/blur itself normally those don't bubble but we use jQuery's delegate which makes use of a few tricks to make it so that it can delegate focus and blur. One of the techniques I know of that it uses is to abuse the w3 standard event handler's 'traversing' rather than bubbling functionality. It might also use another trick to make it work in IE.

#Comment by Hashar (talk | contribs)   20:56, 12 December 2011

I am using Mac OS X indeed.

Looks like this feature unbreak half the browsers and let the other half in the same state. So it is probably fine for now :)

#Comment by Dantman (talk | contribs)   21:27, 12 December 2011

OS X having absolutely screwed up keyboard handling probably isn't something we can do much about at all. You can't tab through normal links in a normal way so it's not really like the issue is specific to this at all.

#Comment by TheDJ (talk | contribs)   22:31, 2 March 2012

it's not that screwed up, and it's also perfectly configurable.

Preferences -> Advanced -> Press Tab to highlight each item on a webpage

#Comment by Brion VIBBER (talk | contribs)   19:19, 21 February 2012

This causes a regression on cached pages, as the hiding doesn't get applied on the div. bug 34504

#Comment by MarkAHershberger (talk | contribs)   18:10, 22 February 2012

I'm assuming r112034 is the fix for this. Change back to FIXME if I'm wrong.

#Comment by Brion VIBBER (talk | contribs)   18:54, 22 February 2012

Yep it's resolved. :)

Status & tagging log