Skip to content

[Select] First option chosen as selected when grouping with ListSubheader #34731

@norayr93

Description

@norayr93

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the 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 with ListSubheader 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.

The input value. Providing an empty string will select no options. Set to an empty string '' if you don't want any of the available options to be selected.

Context 🔦

I have also posted the issue on StackOverflow

Your environment 🌎

npx @mui/envinfo
  System:
    OS: macOS 12.0.1
  Binaries:
    Node: 16.13.0 - ~/.nvm/versions/node/v16.13.0/bin/node
    Yarn: 1.22.17 - ~/.nvm/versions/node/v16.13.0/bin/yarn
    npm: 8.1.0 - ~/.nvm/versions/node/v16.13.0/bin/npm
  Browsers:
    Chrome: 106.0.5249.103
    Edge: Not Found
    Firefox: 104.0.2
    Safari: 15.1
  npmPackages:
    @emotion/react: ^11.9.0 => 11.9.3 
    @emotion/styled: ^11.8.1 => 11.9.3 
    @mui/base:  5.0.0-alpha.101 
    @mui/core-downloads-tracker:  5.10.9 
    @mui/icons-material: ^5.6.2 => 5.8.4 
    @mui/material: ^5.10.9 => 5.10.9 
    @mui/private-theming:  5.10.9 
    @mui/styled-engine:  5.10.8 
    @mui/system:  5.10.9 
    @mui/types:  7.2.0 
    @mui/utils:  5.10.9 
    @types/react: ^18.0.5 => 18.0.14 
    react: ^18.0.0 => 18.2.0 
    react-dom: ^18.0.0 => 18.2.0 
    styled-components: ^5.2.1 => 5.3.5 
    typescript: ^4.6.3 => 4.7.4 

Metadata

Metadata

Assignees

No one assigned

    Labels

    scope: selectChanges related to the select.type: regressionA bug, but worse, it used to behave as expected.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions