r99083 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r99082‎ | r99083 | r99084 >
Date:10:37, 6 October 2011
Author:philip
Status:resolved
Tags:
Comment:
Follow r86861. It's strange to apply the focus/blur behaviour only on #p-cactions menu but not all similar menus. The behaviour itself is buggy - a reclick action will toggle off the menu hide but remain the "focus" icon.
Modified paths:
  • /trunk/phase3/skins/vector/vector.js (modified) (history)

Diff [purge]

Index: trunk/phase3/skins/vector/vector.js
@@ -2,18 +2,35 @@
33 * Vector-specific scripts
44 */
55 jQuery( function( $ ) {
6 - var $pCactions = $( '#p-cactions' );
7 - $pCactions.find( 'h5 a' )
8 - // For accessibility, show the menu when the hidden link in the menu is clicked (bug 24298)
9 - .click( function( e ) {
10 - $pCactions.find( '.menu' ).toggleClass( 'menuForceShow' );
11 - e.preventDefault();
12 - })
13 - // When the hidden link has focus, also set a class that will change the arrow icon
14 - .focus( function() {
15 - $pCactions.addClass( 'vectorMenuFocus' );
16 - })
17 - .blur( function() {
18 - $pCactions.removeClass( 'vectorMenuFocus' );
19 - });
 6+
 7+ // For accessibility, show the menu whe
 8+ // the hidden link in the menu is focused (bug 24298)
 9+ $( 'div.vectorMenu' ).each( function() {
 10+ var self = this;
 11+ var focused = false;
 12+ $( 'h5:first a:first', this )
 13+ .click( function( e ) {
 14+ e.preventDefault();
 15+ } )
 16+ // Blur the link if it was focused before the click
 17+ .mousedown( function( e ) {
 18+ focused = $( this ).is( ':focus' );
 19+ } )
 20+ .mouseup( function( e ) {
 21+ if ( focused ) {
 22+ $( this ).blur();
 23+ }
 24+ e.preventDefault();
 25+ } )
 26+ // When the hidden link has focus, show the menu
 27+ // and set a class that will change the arrow icon
 28+ .focus( function() {
 29+ $( '.menu:first', self ).addClass( 'menuForceShow' );
 30+ $( self ).addClass( 'vectorMenuFocus' );
 31+ } )
 32+ .blur( function() {
 33+ $( '.menu:first', self ).removeClass( 'menuForceShow' );
 34+ $( self ).removeClass( 'vectorMenuFocus' );
 35+ } );
 36+ } );
2037 });

Follow-up revisions

RevisionCommit summaryAuthorDate
r99088Partly revert r99083 because the new behaviour is still buggy...philip12:07, 6 October 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r86861(bug 24298) Make dropdown menus in Vector more accessible by expanding and co...catrope14:08, 25 April 2011

Status & tagging log