jenkins-bot has submitted this change and it was merged.

Change subject: jquery.suggestions: Hide the suggestions list asynchronously
......................................................................


jquery.suggestions: Hide the suggestions list asynchronously

Hiding the link we're just clicking on causes problems when done
synchronously in at least Firefox 3.6 (bug 62858) – the link is not
followed.

Also update incorrect and misformatted comments.

Bug: 62858
Change-Id: I52ed745e66c477527b6af031c222f8f221e0328b
---
M resources/src/jquery/jquery.suggestions.js
1 file changed, 16 insertions(+), 6 deletions(-)

Approvals:
  TheDJ: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/resources/src/jquery/jquery.suggestions.js 
b/resources/src/jquery/jquery.suggestions.js
index 22e8652..7d200ff 100644
--- a/resources/src/jquery/jquery.suggestions.js
+++ b/resources/src/jquery/jquery.suggestions.js
@@ -535,15 +535,20 @@
                                                        if ( $result.get( 0 ) 
!== $other.get( 0 ) ) {
                                                                return;
                                                        }
-                                                       // do not interfere 
with non-left clicks or if modifier keys are pressed (e.g. ctrl-click)
+                                                       // Do not interfere 
with non-left clicks or if modifier keys are pressed (e.g. ctrl-click).
                                                        if ( !( e.which !== 1 
|| e.altKey || e.ctrlKey || e.shiftKey || e.metaKey ) ) {
                                                                
$.suggestions.highlight( context, $result, true );
-                                                               
$.suggestions.hide( context );
                                                                if ( typeof 
context.config.result.select === 'function' ) {
                                                                        
context.config.result.select.call( $result, context.data.$textbox );
                                                                }
+                                                               // This will 
hide the link we're just clicking on, which causes problems
+                                                               // when done 
synchronously in at least Firefox 3.6 (bug 62858).
+                                                               setTimeout( 
function () {
+                                                                       
$.suggestions.hide( context );
+                                                               }, 0 );
                                                        }
-                                                       // but still restore 
focus to the textbox, so that the suggestions will be hidden properly
+                                                       // Always bring focus 
to the textbox, as that's probably where the user expects it
+                                                       // if they were just 
typing.
                                                        
context.data.$textbox.focus();
                                                } )
                                )
@@ -563,14 +568,19 @@
                                                        if ( $special.get( 0 ) 
!== $other.get( 0 ) ) {
                                                                return;
                                                        }
-                                                       // do not interfere 
with non-left clicks or if modifier keys are pressed (e.g. ctrl-click)
+                                                       // Do not interfere 
with non-left clicks or if modifier keys are pressed (e.g. ctrl-click).
                                                        if ( !( e.which !== 1 
|| e.altKey || e.ctrlKey || e.shiftKey || e.metaKey ) ) {
-                                                               
$.suggestions.hide( context );
                                                                if ( typeof 
context.config.special.select === 'function' ) {
                                                                        
context.config.special.select.call( $special, context.data.$textbox );
                                                                }
+                                                               // This will 
hide the link we're just clicking on, which causes problems
+                                                               // when done 
synchronously in at least Firefox 3.6 (bug 62858).
+                                                               setTimeout( 
function () {
+                                                                       
$.suggestions.hide( context );
+                                                               }, 0 );
                                                        }
-                                                       // but still restore 
focus to the textbox, so that the suggestions will be hidden properly
+                                                       // Always bring focus 
to the textbox, as that's probably where the user expects it
+                                                       // if they were just 
typing.
                                                        
context.data.$textbox.focus();
                                                } )
                                                .mousemove( function ( e ) {

-- 
To view, visit https://gerrit.wikimedia.org/r/121701
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I52ed745e66c477527b6af031c222f8f221e0328b
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Bartosz Dziewoński <matma....@gmail.com>
Gerrit-Reviewer: Bartosz Dziewoński <matma....@gmail.com>
Gerrit-Reviewer: Jack Phoenix <j...@countervandalism.net>
Gerrit-Reviewer: Krinkle <krinklem...@gmail.com>
Gerrit-Reviewer: TheDJ <hartman.w...@gmail.com>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to