jquery.suggestions: Trigger keypress on initializing
authorFomafix <fomafix@googlemail.com>
Tue, 14 May 2019 19:46:39 +0000 (21:46 +0200)
committerFomafix <fomafix@googlemail.com>
Thu, 16 May 2019 18:27:54 +0000 (20:27 +0200)
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

index a585cf3..9e6ecc8 100644 (file)
                                                }
                                                $.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