Skip to content

Commit

Permalink
MAGETWO-81146: Fixing #10275 keyboard submit of adminhtml suggest form.
Browse files Browse the repository at this point in the history
  • Loading branch information
Oleksii Korshenko authored Oct 25, 2017
2 parents ae9b756 + e7e085c commit 501b31a
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions lib/web/mage/backend/suggest.js
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@

case keyCode.ENTER:
case keyCode.NUMPAD_ENTER:
this._toggleEnter(event);

if (this.isDropdownShown() && this._focused) {
this._proxyEvents(event);
Expand Down Expand Up @@ -314,6 +315,30 @@
this._bindDropdown();
},

/**
* @param {Object} event - event object
* @private
*/
_toggleEnter: function (event) {
var suggestList,
activeItems,
selectedItem;

suggestList = $(event.currentTarget.parentNode).find('ul').first();
activeItems = suggestList.find('._active');

if (activeItems.length >= 0) {
selectedItem = activeItems.first();

if (selectedItem.find('a') && selectedItem.find('a').attr('href') !== undefined) {
window.location = selectedItem.find('a').attr('href');
event.preventDefault();

return false;
}
}
},

/**
* @param {Object} e - event object
* @private
Expand Down

0 comments on commit 501b31a

Please sign in to comment.