Skip to content

Commit

Permalink
Bugfix: Unable to activate search form on phone
Browse files Browse the repository at this point in the history
This commit fixes the bug, when user was not able to activate search 
form on mobile device after two sequential clicks on search icon (label).

Bug description:

1. First click (Field should show up): `focus` event is triggered and form is shown.
2. Second click (Field should show off): `blur` and `focus` events are triggered
 2.1. Blur event set the timeout to hide the field.
 2.2. Focus event adds the `active` class to the field.
 2.3. Timeout function is called and field becomes hidden.
 2.4. Field is still has `focus` state, because user clicked on label again.
3. **Third click (Field should show up): `blur` and `focus` events are triggered again,
    and field will not show up.**

Proposed patch adds additional logic into 2.1:
**Blur event will set the timeout to hide the field if the field already has `active` class name**
  • Loading branch information
vovayatsyuk committed Mar 14, 2016
1 parent 8fd3e8a commit 81fafc0
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 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 @@ -58,6 +58,9 @@ define([
this.element.attr('autocomplete', this.options.autocomplete);

this.element.on('blur', $.proxy(function () {
if (!this.searchLabel.hasClass('active')) {
return;
}

setTimeout($.proxy(function () {
if (this.autoComplete.is(':hidden')) {
Expand Down

0 comments on commit 81fafc0

Please sign in to comment.