Open subvertallchris opened 7 months ago
Looks like https://github.com/adobe/react-spectrum/pull/869 handled this in listbox, but we'll need to review the behavior to see why it doesn't work for select.
Hey @reidbarber, thanks for taking a look. Any thoughts on the effort level or timeline? Is this something I can reasonably investigate on my own? I'm trying to decide if I should swap my Select implementation for a native HTML select in the meantime.
I would guess it wouldn't be too difficult of a fix once the cause is identified. Another related PR to look at is #1374. This maybe something to look at:
There is a useSelect story in storybook that would make a quick feedback loop to test things. The main thing to look for is why the event makes it all the way to the onKeyDown
handler in useMenuTrigger
.
Provide a general summary of the issue here
The native HTML
select
element allows one to focus and then type an option name, like "new york" to select it. TheSelect
element from react-aria-components instead opens the menu when spacebar is pressed and does not respect the spacebar as part of the typed selection state. Keyboard selection is broken as a result.๐ค Expected Behavior?
One should be able to focus on a
Select
and type a multi-word option.๐ฏ Current Behavior
This fails as soon as you hit the space bar. See https://codesandbox.io/p/sandbox/async-flower-lj4gz5 for a usable demo. It also includes an example of the native
select
element.Note that if you open the menu first and then type, "New York" can be selected.
๐ Possible Solution
I would expect some combination of the following
๐ฆ Context
The ability to quickly navigate and fill in forms is something I expect with all form elements. I hit this repeatedly while working on an e-commerce system, where Select Option elements might be multiple words. You'll notice that all of the examples on in the docs are single words, so it wouldn't be immediately obvious.
๐ฅ๏ธ Steps to Reproduce
See the reproduction here https://codesandbox.io/p/sandbox/async-flower-lj4gz5.
Version
1.1.0
What browsers are you seeing the problem on?
Firefox, Chrome, Safari
If other, please specify.
No response
What operating system are you using?
Mac OS
๐งข Your Company/Team
No response
๐ท Tracking Issue
No response