Allow users to submit by "enter" keypress on #search_field

Review Request #5423 — Created Feb. 7, 2014 and submitted — Latest diff uploaded

Information

Review Board
master

Reviewers

Allow users to submit by "enter" keypress on #search_field

This addresses Issue 3032, where the Search cannot be completed by pressing the
enter key.

Once the user inputs a text in the serach field, the jQuery UI attempts to
autocomplete the query. Currently, the search can only be completed through a
mouse click. On enter keypress, the autocomplete adds a comma do the currently
selected input and seeks for another query, but does not redirect.

This has been fixed by adding a new "option" on the ui.autocomplete.js
ui.rbautocomplete module, called enterToURL. This closely mimics the already
existing clickToURL by simply listening to the enter keypress and calling
the click event when the user presses a selected item.

Additionally, the "multiple" option was set to false, which disallows users
to search for more than one query at a time.

This does not modify the behaviour of other autocomplete text boxes as it uses
a new option that is by default false.

I typed my username "mirai" in the search field, and select the option by
using the arrow keys. Once enter is hit, the search redirects to my user page.

Other random text queries including reviews work as well.

/js-tests pass 100%

    Loading...