Skip to content

Commit

Permalink
Fixing keyboard submit of adminhtml suggest form.
Browse files Browse the repository at this point in the history
  • Loading branch information
romainruaud committed Oct 6, 2017
1 parent 9db4501 commit eefdc1c
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions lib/web/mage/backend/suggest.js
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,20 @@

case keyCode.ENTER:
case keyCode.NUMPAD_ENTER:
suggestList = event.currentTarget.parentNode.getElementsByTagName('ul')[0];
hasSelectedItems = suggestList.getElementsByClassName('_active').length >= 0;

if (hasSelectedItems) {
selectedItem = $(suggestList.getElementsByClassName('_active')[0]);
/* eslint-disable max-depth */
if (selectedItem.find('a') && selectedItem.find('a').attr('href') !== undefined) {
window.location = selectedItem.find('a').attr('href');
event.preventDefault();

return false;
}
/* eslint-enable max-depth */
}

if (this.isDropdownShown() && this._focused) {
this._proxyEvents(event);
Expand Down

0 comments on commit eefdc1c

Please sign in to comment.