Open ryo-manba opened 1 week ago
I think it's better practice to separate the two and use a map to determine the country code instead. That way you know which country the user is actually trying to reach.
Can bring up with the team when everyone is back from shutdown since it technically works for native select's.
Thanks you for your suggestion. That approach sounds good.
However, making it work similar to a native select might enhance usability even further. It would be great to use the value
directly in ListboxItem
, but since it accepts an object, some adjustments will be necessary.
Provide a general summary of the issue here
When using Select with the same id for options, they are not displayed. This is problematic because in forms, the id is reflected as the value. For example, both Italy and Vatican have the country code 39.
๐ค Expected Behavior?
The same value can be specified for options.
๐ฏ Current Behavior
When trying to specify the same value for options, they are not displayed.
๐ Possible Solution
Instead of using
selectedKey
for the input value in HiddenSelect, it might be better to use the item'stextValue
. This may diverge from the intended use oftextValue
but could resolve the issue.https://github.com/adobe/react-spectrum/blob/main/packages/@react-aria/select/src/HiddenSelect.tsx#L156
๐ฆ Context
Handling duplicate values in select options, such as country codes, is a valid use case and should be supported.
๐ฅ๏ธ Steps to Reproduce
Version
react-aria-components: 1.2.1
What browsers are you seeing the problem on?
Chrome
If other, please specify.
No response
What operating system are you using?
MacOS Sonoma
๐งข Your Company/Team
No response
๐ท Tracking Issue
No response