[Select][base-ui][joy-ui] Option with `null` value cannot be marked as selected
Open
@siriwatknp is already working on this.
Since May 8, 2023.
discussion
on hold
package: joy-ui
scope: select
- Dominant language
- JavaScript
- Stars
- 99.1k
- Forks
- 32.5k
- Avg merge
- 2d 17h
- Merged PRs (30d)
- 106
Description
Duplicates
- I have searched the existing issues
Latest version
- I have tested the latest version
Steps to reproduce 🕹
Link to live example: https://codesandbox.io/s/elated-field-eygwhs?file=/demo.js
Steps:
- Select the "None" option
- Open the select again, the "None" option won't be marked as active
Current behavior 😯
When selecting a Option with its value set to null, the Select box itself will correctly show "None" as its active value, but the dropdown will not mark the option.
There is more inconsistent and unexpected behavior too:
- When the option with
nulland opening the menu again you can now not navigate with the arrow-down key away from it. Only arrow up will move the focus to another option. Once another option is in focus the arrow keys work as expected. - Once focus is not on the option with
nullas its value, it is now impossible to go back tonull. While the option is still counted when navigating with the arrow keys (it takes 2 keystrokes to move from above it to below it as expected) the option itself is never in focus.
Expected behavior 🤔
The null option is marked as the selected value and can be selected with keyboard navigation.
Context 🔦
No response
Your environment 🌎
npx @mui/envinfo
Don't forget to mention which browser you used.
Output from `npx @mui/envinfo` goes here.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.