r99088 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r99087‎ | r99088 | r99089 >
Date:12:07, 6 October 2011
Author:philip
Status:ok (Comments)
Tags:
Comment:
Partly revert r99083 because the new behaviour is still buggy...
Modified paths:
  • /trunk/phase3/skins/vector/vector.js (modified) (history)

Diff [purge]

Index: trunk/phase3/skins/vector/vector.js
@@ -2,35 +2,20 @@
33 * Vector-specific scripts
44 */
55 jQuery( function( $ ) {
6 -
7 - // For accessibility, show the menu whe
8 - // the hidden link in the menu is focused (bug 24298)
96 $( 'div.vectorMenu' ).each( function() {
107 var self = this;
11 - var focused = false;
128 $( 'h5:first a:first', this )
 9+ // For accessibility, show the menu when the hidden link in the menu is clicked (bug 24298)
1310 .click( function( e ) {
 11+ $( '.menu:first', self ).toggleClass( 'menuForceShow' );
1412 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
 13+ })
 14+ // When the hidden link has focus, also set a class that will change the arrow icon
2815 .focus( function() {
29 - $( '.menu:first', self ).addClass( 'menuForceShow' );
3016 $( self ).addClass( 'vectorMenuFocus' );
31 - } )
 17+ })
3218 .blur( function() {
33 - $( '.menu:first', self ).removeClass( 'menuForceShow' );
3419 $( self ).removeClass( 'vectorMenuFocus' );
35 - } );
36 - } );
 20+ });
 21+ });
3722 });

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r99083Follow r86861. It's strange to apply the focus/blur behaviour only on #p-cact...philip10:37, 6 October 2011

Comments

#Comment by Krinkle (talk | contribs)   01:27, 30 December 2011

Looks good. Although you didn't introduce it, I'd recommend using $( self ).find( '.menu:first' ) instead of $( '.menu:first', self ). Reason being that the former is easier to read, and is also faster because jQuery doesn't have to re-create the object for it and it actually does a call to itself in the form of $( context ).find( selector );.

Status & tagging log