diff options
author | Fomafix <fomafix@googlemail.com> | 2019-06-05 08:01:36 +0200 |
---|---|---|
committer | Fomafix <fomafix@googlemail.com> | 2019-06-10 15:41:47 +0200 |
commit | 97675af31ac1f8599e43530c23b71da26f1ba5ec (patch) | |
tree | f4dbb559fd3f0e7cb71dc47d6e4de64ae21eeb05 /resources/src/jquery/jquery.suggestions.js | |
parent | e2ef870ee2da2940dc69a9c69fd2572039a606d4 (diff) | |
download | mediawikicore-97675af31ac1f8599e43530c23b71da26f1ba5ec.tar.gz mediawikicore-97675af31ac1f8599e43530c23b71da26f1ba5ec.zip |
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
Diffstat (limited to 'resources/src/jquery/jquery.suggestions.js')
-rw-r--r-- | resources/src/jquery/jquery.suggestions.js | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/resources/src/jquery/jquery.suggestions.js b/resources/src/jquery/jquery.suggestions.js index 25f57efa878e..7b10149b90bd 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 ); } } |