r50205 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r50204‎ | r50205 | r50206 >
Date:21:07, 4 May 2009
Author:rainman
Status:ok
Tags:
Comment:
Fix annoying bug with mwsuggest that makes it shown suggestions after search box has lost focus (which it shouldn't).
Introduce additional attribute that tells the suggestion container that it should stay hidden.
Modified paths:
  • /trunk/phase3/includes/DefaultSettings.php (modified) (history)
  • /trunk/phase3/skins/common/mwsuggest.js (modified) (history)

Diff [purge]

Index: trunk/phase3/skins/common/mwsuggest.js
@@ -78,6 +78,7 @@
7979 this.containerRow = 0; // height of result field in the container
8080 this.containerTotal = 0; // total height of the container will all results
8181 this.visible = false; // if container is visible
 82+ this.stayHidden = false; // don't try to show if lost focus
8283 }
8384
8485 /** Hide results div */
@@ -93,6 +94,8 @@
9495 function os_showResults(r){
9596 if(os_is_stopped)
9697 return;
 98+ if(r.stayHidden)
 99+ return
97100 os_fitContainer(r);
98101 var c = document.getElementById(r.container);
99102 r.selected = -1;
@@ -442,6 +445,7 @@
443446 /** Init timed update via os_delayedUpdate() */
444447 function os_fetchResults(r, query, timeout){
445448 if(query == ""){
 449+ r.query = "";
446450 os_hideResults(r);
447451 return;
448452 } else if(query == r.query)
@@ -622,13 +626,19 @@
623627 var r = os_map[targ.id];
624628 if(r == null)
625629 return; // not our event
626 - if(!os_mouse_pressed)
 630+ if(!os_mouse_pressed){
627631 os_hideResults(r);
 632+ r.stayHidden = true
 633+ }
628634 }
629635
630636 /** Event: focus (catch only when stopped) */
631637 function os_eventFocus(e){
632 - // nothing happens here?
 638+ var targ = os_getTarget(e);
 639+ var r = os_map[targ.id];
 640+ if(r == null)
 641+ return; // not our event
 642+ r.stayHidden = false
633643 }
634644
635645
Index: trunk/phase3/includes/DefaultSettings.php
@@ -1477,7 +1477,7 @@
14781478 * to ensure that client-side caches don't keep obsolete copies of global
14791479 * styles.
14801480 */
1481 -$wgStyleVersion = '217';
 1481+$wgStyleVersion = '218';
14821482
14831483
14841484 # Server-side caching:

Follow-up revisions

RevisionCommit summaryAuthorDate
r50210Addendum for r50205, also explicitly cancel any pending fetches just to be sure.rainman23:33, 4 May 2009

Status & tagging log