From 90f884f8bb5cdf803042ee65dbd9986cc6d094d1 Mon Sep 17 00:00:00 2001 From: Mateusz Krzeszowiak Date: Wed, 7 Mar 2018 11:14:09 +0100 Subject: [PATCH] Act better on existing input focus instead of removing it The focus of the input field is maintained, proper classes are added and autocomplete fires once the component is initialized. --- app/code/Magento/Search/view/frontend/web/form-mini.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Search/view/frontend/web/form-mini.js b/app/code/Magento/Search/view/frontend/web/form-mini.js index 02a8f618a2298..66a76822c63b7 100644 --- a/app/code/Magento/Search/view/frontend/web/form-mini.js +++ b/app/code/Magento/Search/view/frontend/web/form-mini.js @@ -89,7 +89,9 @@ define([ }, this), 250); }, this)); - this.element.trigger('blur'); + if (this.element.get(0) === document.activeElement) { + this.setActiveState(true); + } this.element.on('focus', this.setActiveState.bind(this, true)); this.element.on('keydown', this._onKeyDown);