MudBlazor/MudBlazor

MudAutocomplete propagates Enter key to form submission when opening dropdown or selecting items

開放

#7,665 建立於 2023年10月19日

 (2 則留言) (3 個反應) (0 位負責人)C# (1,631 個分叉)batch import
buggood first issue

倉庫指標

星標
 (10,394 顆星)
PR 合併指標
 (平均合併 6天 6小時) (30 天內合併 108 個 PR)

描述

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

  1. Open the snippet
  2. focus on first name fill anything
  3. press tab (us states should be focused
  4. press Enter
  5. Notice the dropdown opens
  6. Notice there is a submit added on the rightside which is done by using the OnSubmit of the form
  7. use the arrows on the keyboard to select an item
  8. press enter to select one
  9. notice the dropdown closes
  10. notice another submit is added to the list
  11. press tab twice
  12. this is the MudSelect component, press enter
  13. Notice the dropdown opens
  14. Notice there isn't any submit added on the rightside
  15. use the arrows on the keyboard to select an item
  16. press enter to select one item
  17. notice the dropdown closes
  18. 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

貢獻者指南