MudAutocomplete propagates Enter key to form submission when opening dropdown or selecting items
#7,665 opened on Oct 19, 2023
Repository metrics
- Stars
- (10,394 stars)
- PR merge metrics
- (Avg merge 6d 6h) (108 merged PRs in 30d)
Description
Bug type
Component
Component name
MudAutocomplete
What happened?
EditForm Submit is triggered unexpectedly when Enter is pressed while the component is in focus. (it also opens the dropdown as it should) This is a problem to open the dropdown and also to select an item in the dropdown. On both events submit is triggered on the form.
While using MudSelect it works as expected
Expected behavior
While having focus on the MudAutocomplete component a keypress on Enter should only open the dropdown.
While having opened on the MudAutocomplete component dropdown and select an item a keypress on Enter should only select the item, and close the dropdown.
Reproduction link
https://try.mudblazor.com/snippet/mamnbEPDHXepRSYa
Reproduction steps
- Open the snippet
- focus on first name fill anything
- press tab (us states should be focused
- press Enter
- Notice the dropdown opens
- Notice there is a submit added on the rightside which is done by using the OnSubmit of the form
- use the arrows on the keyboard to select an item
- press enter to select one
- notice the dropdown closes
- notice another submit is added to the list
- press tab twice
- this is the MudSelect component, press enter
- Notice the dropdown opens
- Notice there isn't any submit added on the rightside
- use the arrows on the keyboard to select an item
- press enter to select one item
- notice the dropdown closes
- Notice there isn't any submit added on the rightside
Relevant log output
For log output just have a look at the screen the submits are shown on the right side of the app
Version (bug)
6.11..0
Version (working)
No response
What browsers are you seeing the problem on?
Chrome, Microsoft Edge, Safari
On what operating system are you experiencing the issue?
Mac OSX
Pull Request
- I would like to do a Pull Request
Code of Conduct
- I agree to follow this project's Code of Conduct