-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Select] First option chosen as selected when grouping with ListSubheader #34731
Comments
This is a regression introduced in #27299. We should not add the item as |
Yes, it seems that it's incorrectly selecting the first element in this case. Unfortunately, the tests did not cover this scenario. @norayr93 would you like to contribute to the project by working on a fix? |
Unsure if this is related but I believe this issue also occurs when the Select component is in Multi-select mode |
@michaldudak: Mind that this is bug, because the mentioned regression selected the first selectable item to enable keyboard interaction with the The Select doesn't even need to use I've created a new issue related to this bug just yesterday (#36018), which is a duplicate of this one, but has a lot more information in the description pointing to erroneous code directly. |
No. Multi select should work fine, because empty array (no items selected) is not falsey.
|
Duplicates
Latest version
Steps to reproduce 🕹
https://codesandbox.io/s/eloquent-architecture-in71n1 - It's a simple grouping.
Current behavior 😯
Select chooses the first option as
selected
when using grouping withListSubheader
and the initial value is an empty string.Expected behavior 🤔
Select doesn't have a selected option when the value is an empty string.It's also stated in the docs.
Context 🔦
I have also posted the issue on StackOverflow
Your environment 🌎
npx @mui/envinfo
The text was updated successfully, but these errors were encountered: