Skip to content
This repository was archived by the owner on Apr 29, 2019. It is now read-only.

Commit 154dd01

Browse files
committed
Can't close mobile search bar
1 parent 79f9c8a commit 154dd01

File tree

1 file changed

+32
-30
lines changed

1 file changed

+32
-30
lines changed

app/code/Magento/Search/view/frontend/web/form-mini.js

Lines changed: 32 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ define([
8888
}
8989

9090
setTimeout($.proxy(function () {
91-
if (this.autoComplete.css('display', 'none')) {
91+
if (this.autoComplete.is(':hidden')) {
9292
this.setActiveState(false);
9393
} else {
9494
this.element.trigger('focus');
@@ -288,44 +288,46 @@ define([
288288
}, $.proxy(function (data) {
289289
$.each(data, function (index, element) {
290290
var html;
291-
292291
element.index = index;
293292
html = template({
294293
data: element
295294
});
296295
dropdown.append(html);
297296
});
298-
this.responseList.indexList = this.autoComplete.html(dropdown)
299-
.css(clonePosition)
300-
.show()
301-
.find(this.options.responseFieldElements + ':visible');
302297

303-
this._resetResponseList(false);
304-
this.element.removeAttr('aria-activedescendant');
298+
if (dropdown.has('li').length) {
299+
this.responseList.indexList = this.autoComplete.html(dropdown)
300+
.css(clonePosition)
301+
.show()
302+
.find(this.options.responseFieldElements + ':visible');
305303

306-
if (this.responseList.indexList.length) {
307-
this._updateAriaHasPopup(true);
308-
} else {
309-
this._updateAriaHasPopup(false);
310-
}
304+
this._resetResponseList(false);
305+
this.element.removeAttr('aria-activedescendant');
311306

312-
this.responseList.indexList
313-
.on('click', function (e) {
314-
this.responseList.selected = $(e.currentTarget);
315-
this.searchForm.trigger('submit');
316-
}.bind(this))
317-
.on('mouseenter mouseleave', function (e) {
318-
this.responseList.indexList.removeClass(this.options.selectClass);
319-
$(e.target).addClass(this.options.selectClass);
320-
this.responseList.selected = $(e.target);
321-
this.element.attr('aria-activedescendant', $(e.target).attr('id'));
322-
}.bind(this))
323-
.on('mouseout', function (e) {
324-
if (!this._getLastElement() && this._getLastElement().hasClass(this.options.selectClass)) {
325-
$(e.target).removeClass(this.options.selectClass);
326-
this._resetResponseList(false);
327-
}
328-
}.bind(this));
307+
if (this.responseList.indexList.length) {
308+
this._updateAriaHasPopup(true);
309+
} else {
310+
this._updateAriaHasPopup(false);
311+
}
312+
313+
this.responseList.indexList
314+
.on('click', function (e) {
315+
this.responseList.selected = $(e.currentTarget);
316+
this.searchForm.trigger('submit');
317+
}.bind(this))
318+
.on('mouseenter mouseleave', function (e) {
319+
this.responseList.indexList.removeClass(this.options.selectClass);
320+
$(e.target).addClass(this.options.selectClass);
321+
this.responseList.selected = $(e.target);
322+
this.element.attr('aria-activedescendant', $(e.target).attr('id'));
323+
}.bind(this))
324+
.on('mouseout', function (e) {
325+
if (!this._getLastElement() && this._getLastElement().hasClass(this.options.selectClass)) {
326+
$(e.target).removeClass(this.options.selectClass);
327+
this._resetResponseList(false);
328+
}
329+
}.bind(this));
330+
}
329331
}, this));
330332
} else {
331333
this._resetResponseList(true);

0 commit comments

Comments
 (0)