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

Commit eefdc1c

Browse files
committed
Fixing keyboard submit of adminhtml suggest form.
1 parent 9db4501 commit eefdc1c

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

lib/web/mage/backend/suggest.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,20 @@
245245

246246
case keyCode.ENTER:
247247
case keyCode.NUMPAD_ENTER:
248+
suggestList = event.currentTarget.parentNode.getElementsByTagName('ul')[0];
249+
hasSelectedItems = suggestList.getElementsByClassName('_active').length >= 0;
250+
251+
if (hasSelectedItems) {
252+
selectedItem = $(suggestList.getElementsByClassName('_active')[0]);
253+
/* eslint-disable max-depth */
254+
if (selectedItem.find('a') && selectedItem.find('a').attr('href') !== undefined) {
255+
window.location = selectedItem.find('a').attr('href');
256+
event.preventDefault();
257+
258+
return false;
259+
}
260+
/* eslint-enable max-depth */
261+
}
248262

249263
if (this.isDropdownShown() && this._focused) {
250264
this._proxyEvents(event);

0 commit comments

Comments
 (0)