When using the keyboard to select an option; pressing enter will trigger the parent form's onSubmit. I think we should call stopPropagation() of the event so it does not bubble up to the form.
Select the option and don't trigger the for submission.
Select the option and trigger the for submission.
See https://codesandbox.io/s/oqmom5qrxz
Just for context, in case it's helpful, I had to do something similar in my codebase. I had to modify KeypressListener to listen to keydown event in case of Enter, because that's what triggers form submit, it's too late to stopPropagation() on keyup.
Autocomplete is currently being reworked as a part of the AutoComplete component project. Once we address this problem in the reworked component, we鈥檒l close this issue.
Most helpful comment
Just for context, in case it's helpful, I had to do something similar in my codebase. I had to modify KeypressListener to listen to
keydownevent in case of Enter, because that's what triggers form submit, it's too late to stopPropagation() onkeyup.