diff --git a/lib/web/mage/backend/suggest.js b/lib/web/mage/backend/suggest.js index 81bde35f9e12a..412a80804ae0f 100644 --- a/lib/web/mage/backend/suggest.js +++ b/lib/web/mage/backend/suggest.js @@ -245,6 +245,7 @@ case keyCode.ENTER: case keyCode.NUMPAD_ENTER: + this._toggleEnter(event); if (this.isDropdownShown() && this._focused) { this._proxyEvents(event); @@ -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