Skip to content

Commit

Permalink
After closing the autocomplete dropdown by clicking away from it, ret…
Browse files Browse the repository at this point in the history
…urn focus to the search input element.

Otherwise the searchbox that was opened will not close when clicking away from it. You need to return the focus to it by clicking it again, and only then you can close it by clicking away from it.

Steps to reproduce: Search something that gets some search result so that the autocomplete gets populated. Start searching for it again so that the dropdown opens. Click away (dropdown should close). Click away again (the search bar will not close, against user expectation).
  • Loading branch information
evktalo committed Jan 17, 2017
1 parent 1856c28 commit 0f53f67
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app/code/Magento/Search/view/frontend/web/form-mini.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ define([
setTimeout($.proxy(function () {
if (this.autoComplete.is(':hidden')) {
this.setActiveState(false);
} else {
this.element.trigger('focus');
}
this.autoComplete.hide();
this._updateAriaHasPopup(false);
Expand Down

0 comments on commit 0f53f67

Please sign in to comment.