Closed matheusboeira closed 4 months ago
Please share the code also.
@wingkwong it's reproducible here: code. It doesn't work only in keyboard. Try to select an item using keyboard.
@matheusboeira you need to set onKeyDown={() => setLanguage(lang.code)}
. OnPress only captures press event only.
@wingkwong, hmm. But I want to change the language after I press the "space" in my keyboard, not on arrow keys. And what about the tabIndex? I want to focus Dropdown first item when DropdownTrigger is open (after pressing space).
Version 2.2.10 works as expected. Pressing "Space" opens Dropdown and focus the first item. Items can be "selected" pressing space.
@matheusboeira oh ok. I misunderstood the problem.
As a user, I would like that when pressing the keyboard "space" while the Dropdown is focused, it focuses on the Dropdown items.
This seems missing indeed.
Furthermore, pressing the keyboard "Enter" or "Space" should select the item.
To set the language, here we still need onKeyDown={() => setLanguage(lang.code)}
@wingkwong exactly the same code works as expected in version 2.2.10. Pressing "Space" opens Dropdown and focus the first item. Items can be "selected" (change the language) pressing space.
@matheusboeira can you confirm the following behaviours in 2.2.10?
@wingkwong, yes! It should be like that!
https://github.com/nextui-org/nextui/assets/76896958/2e0784a6-4391-48e0-9ec5-ad83beab2ab9
@matheusboeira Thanks a lot. much cleaner. will take a look.
I had the same problem but it seems it was fixed, just saying to confirm the bug fix ^_^
NextUI Version
2.3.5
Describe the bug
When you focus on the DropdownTrigger, the next step is to press "space" to open the Dropdown. When you press it, you should focus on the first item in the list. Well, that doesn't happen. Furthermore, when you focus on the DropdownItem (after pressing tab until it gets focused), and then press Enter or Space, it closes without selecting the item.
Your Example Website or App
No response
Steps to Reproduce the Bug or Issue
Expected behavior
As a user, I would like that when pressing the keyboard "space" while the Dropdown is focused, it focuses on the Dropdown items. Furthermore, pressing the keyboard "Enter" or "Space" should select the item.
Screenshots or Videos
https://github.com/nextui-org/nextui/assets/76896958/a510acc4-b40b-4145-bcd8-6918220e0dc0
Operating System Version
macOS
Browser
Chrome