r101274 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r101273‎ | r101274 | r101275 >
Date:17:39, 29 October 2011
Author:liangent
Status:deferred
Tags:
Comment:
Make sure custom collapsible elements can be always keyboard navigated to
Modified paths:
  • /branches/liangent/makeCollapsible_custom/phase3/resources/jquery/jquery.makeCollapsible.js (modified) (history)

Diff [purge]

Index: branches/liangent/makeCollapsible_custom/phase3/resources/jquery/jquery.makeCollapsible.js
@@ -268,6 +268,15 @@
269269 $customTogglers.bind( 'click.mw-collapse', function( e ) {
270270 toggleLinkCustom( $(this), e, $that );
271271 } );
 272+
 273+ // If there's no link for users using keyboard navigation
 274+ if ( !$customTogglers.is( 'a' ) && !$customTogglers.find( 'a' ).length ) {
 275+ $customTogglers.attr( 'tabindex', '0' ).bind( 'keydown.mw-collapse', function( e ) {
 276+ if ( e.which === 13 ) { // Enter key
 277+ toggleLinkCustom( $(this), e, $that );
 278+ }
 279+ } );
 280+ }
272281 } else {
273282 mw.log( _fn + '#' + thatId + ': Missing toggler!' );
274283 }
@@ -289,6 +298,15 @@
290299 $customTogglers.bind( 'click.mw-collapse', function( e ) {
291300 toggleLinkCustom( $(this), e, $that );
292301 } );
 302+
 303+ // If there's no link for users using keyboard navigation
 304+ if ( !$customTogglers.is( 'a' ) && !$customTogglers.find( 'a' ).length ) {
 305+ $customTogglers.attr( 'tabindex', '0' ).bind( 'keydown.mw-collapse', function( e ) {
 306+ if ( e.which === 13 ) { // Enter key
 307+ toggleLinkCustom( $(this), e, $that );
 308+ }
 309+ } );
 310+ }
293311 } else {
294312 mw.log( _fn + '.mw-customcollapsiblechildren: Missing toggler!' );
295313 }

Status & tagging log