From 97675af31ac1f8599e43530c23b71da26f1ba5ec Mon Sep 17 00:00:00 2001 From: Fomafix Date: Wed, 5 Jun 2019 08:01:36 +0200 Subject: [PATCH 1/1] 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 --- resources/src/jquery/jquery.suggestions.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 ); } } -- 2.20.1