Skip to content

Mini search field looses focus after its JavaScript is initialized #13988

@krzksz

Description

@krzksz

Preconditions

  1. Any Magento 2.x.x installation, e.g. http://magento2-demo.nexcess.net/

Steps to reproduce

  1. Open Magento 2 shop.
  2. Focus mini search field before JavaScript manages to load and optionally start writing some query there.

Expected result

  1. The focus is maintained when the component is initialized.

Actual result

  1. After mini search component's JavaScript loads and initializes, search input loses focus and user has to focus it again.

As far as I understand this part of the code is responsible for above behavior:


I suspect it was added to correctly toggle active classes attached to focus event by forcing the user to reselect input field. I'm creating PR which will make code check current active element and triggers setActiveState method if it is our component's input.

Metadata

Metadata

Assignees

Labels

Fixed in 2.1.xThe issue has been fixed in 2.1 release lineFixed in 2.2.xThe issue has been fixed in 2.2 release lineFixed in 2.3.xThe issue has been fixed in 2.3 release lineIssue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passedIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentReproduced on 2.2.xThe issue has been reproduced on latest 2.2 releaseReproduced on 2.3.xThe issue has been reproduced on latest 2.3 release

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions