From: Fomafix Date: Wed, 5 Jun 2019 06:01:36 +0000 (+0200) Subject: jquery.suggestions: Load initial suggestions only when focused X-Git-Tag: 1.34.0-rc.0~1449^2 X-Git-Url: http://git.cyclocoop.org/data/%7B%24admin_url%7Dconfig?a=commitdiff_plain;h=97675af31ac1f8599e43530c23b71da26f1ba5ec;p=lhc%2Fweb%2Fwiklou.git jquery.suggestions: Load initial suggestions only when focused Firefox restores the value of the search field on browser history back on some special pages with OOUI search suggestions. In this case the value of the search field gets also changed before JavaScript gets initialized and the search suggestions get loaded. This change loads the initial suggestions only when the search field is focused and the value is changed before initializing JavaScript. Bug: T224952 Change-Id: I30d334ae61b40666f14c2b6f82fe7f66ebc8fba0 --- diff --git a/resources/src/jquery/jquery.suggestions.js b/resources/src/jquery/jquery.suggestions.js index 25f57efa87..7b10149b90 100644 --- a/resources/src/jquery/jquery.suggestions.js +++ b/resources/src/jquery/jquery.suggestions.js @@ -767,7 +767,7 @@ } ); // Load suggestions if the value is changed because there are already // typed characters before the JavaScript is loaded. - if ( this.value !== this.defaultValue ) { + if ( $( this ).is( ':focus' ) && this.value !== this.defaultValue ) { update( context, false ); } }