Skip to content

Commit

Permalink
Fixed TypeError: this._getFirstVisibleElement(...).addClass when sear…
Browse files Browse the repository at this point in the history
…ch term does not exist on pressing Home or End button #14274
  • Loading branch information
Dragan Atanasov committed Mar 24, 2018
1 parent 068a97e commit bd47df7
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions app/code/Magento/Search/view/frontend/web/form-mini.js
Expand Up @@ -206,13 +206,17 @@ define([

switch (keyCode) {
case $.ui.keyCode.HOME:
this._getFirstVisibleElement().addClass(this.options.selectClass);
this.responseList.selected = this._getFirstVisibleElement();
if(this._getFirstVisibleElement()) {
this._getFirstVisibleElement().addClass(this.options.selectClass);
this.responseList.selected = this._getFirstVisibleElement();
}
break;

case $.ui.keyCode.END:
this._getLastElement().addClass(this.options.selectClass);
this.responseList.selected = this._getLastElement();
if(this._getFirstVisibleElement()) {
this._getLastElement().addClass(this.options.selectClass);
this.responseList.selected = this._getLastElement();
}
break;

case $.ui.keyCode.ESCAPE:
Expand Down

0 comments on commit bd47df7

Please sign in to comment.