From 72f61f7a5930cf03d4e8ddde62c2ef627b05dd69 Mon Sep 17 00:00:00 2001 From: Fomafix Date: Tue, 14 May 2019 21:46:39 +0200 Subject: [PATCH] jquery.suggestions: Trigger keypress on initializing The keypress event triggers a search suggestion window when there are already typed characters in the search field while loading the JavaScript. Bug: T223422 Change-Id: I2bd79722ab20cde268fdb43338096c792b95ea28 --- resources/src/jquery/jquery.suggestions.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/resources/src/jquery/jquery.suggestions.js b/resources/src/jquery/jquery.suggestions.js index a585cf384e..9e6ecc888d 100644 --- a/resources/src/jquery/jquery.suggestions.js +++ b/resources/src/jquery/jquery.suggestions.js @@ -776,7 +776,10 @@ } $.suggestions.hide( context ); $.suggestions.cancel( context ); - } ); + } ) + // Simulate a keypress on load. This loads the search suggestions when there are already + // typed characters before the JavaScript is loaded. + .trigger( 'keypress' ); } // Store the context for next time -- 2.20.1