From: Fomafix Date: Tue, 14 May 2019 19:46:39 +0000 (+0200) Subject: jquery.suggestions: Trigger keypress on initializing X-Git-Tag: 1.34.0-rc.0~1603^2 X-Git-Url: https://git.cyclocoop.org/%7B%7B%20url_for%28%27admin_user_edit%27%2C%20iduser=user.userid%29%20%7D%7D?a=commitdiff_plain;h=72f61f7a5930cf03d4e8ddde62c2ef627b05dd69;p=lhc%2Fweb%2Fwiklou.git 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 --- 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