wiki.techinc.nl/resources/jquery/jquery.mw-jump.js
Daniel Friesen db1a37382c 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)
2011-09-25 00:49:39 +00:00

15 lines
449 B
JavaScript

/**
* JavaScript to show jump links to motor-impaired users when they are focused.
*/
jQuery( function( $ ) {
$('.mw-jump').delegate( 'a', 'focus blur', function( e ) {
// Confusingly jQuery leaves e.type as "focusout" for delegated blur events
if ( e.type === "blur" || e.type === "focusout" ) {
$( this ).closest( '.mw-jump' ).css({ height: '0' });
} else {
$( this ).closest( '.mw-jump' ).css({ height: 'auto' });
}
} );
} );