Closed
Description
When submitting the search form in the header with the enter key on the keyboard, event handlers that were bound to the form submit (through jQuery) are fired twice.
Preconditions
- PHP 7.0
- CE 2.2 (also tested 2.1.11)
Steps to reproduce
- Create a javascript which adds an event handler to the form submit
$('#search_mini_form').on('submit', function(e) {
console.log('listening for form submit');
});
- Submit the search form in the header with a value by pressing the enter button
Expected result
- Our created listener is only fired once
Actual result
- Listener is fired twice
In module-search/view/frontend/web/form-mini.js the _onKeyDown function is adding a trigger to the enter key
case $.ui.keyCode.ENTER:
this.searchForm.trigger('submit');
break;
This trigger is causing the submit event to be fired twice
Metadata
Metadata
Assignees
Labels
The issue has been fixed in 2.1 release lineThe issue has been fixed in 2.2 release lineThe issue has been fixed in 2.3 release lineGate 3 Passed. Manual verification of the issue completed. Issue is confirmedGate 1 Passed. Automatic verification of issue format passedGate 4. Acknowledged. Issue is added to backlog and ready for developmentThe issue has been reproduced on latest 2.1 releaseThe issue has been reproduced on latest 2.2 releaseThe issue has been reproduced on latest 2.3 release