mui / material-ui

Material UI: Comprehensive React component library that implements Google's Material Design. Free forever.
https://mui.com/material-ui/
MIT License
93.96k stars 32.27k forks source link

[material-ui][Menu] `disableScrollLock` doesn't work for Select when wrapper's overflow hidden #42323

Open erfoon opened 5 months ago

erfoon commented 5 months ago

Steps to reproduce

Link to live example: Sandbox example (Just click on the Select component)

Steps:

  1. Inside a component with overflow = hidden create a Select using Select and MenuItem components
  2. Make Select component scrollIntoView on focus
  3. Observe that Menus get away from the Select component although disableScrollLock should stop it

Current behavior

The MenuItems get away from the select 2024-05-22 01 22 28 I use overflow=hidden for the main parent component of my app, so there's nothing I can easily change

Expected behaviour

When disableScrollLock is true, MenuItems should always stick to the Select component, regardless of the style and properties of the parent components.

Context

No response

Your environment

I use Chrome Version 124, but same behaviour with Firefox and Safari

npx @mui/envinfo ``` System: OS: macOS 14.4.1 Binaries: Node: 20.12.2 - ~/.nvm/versions/node/v20.12.2/bin/node npm: 10.5.0 - ~/.nvm/versions/node/v20.12.2/bin/npm pnpm: Not Found Browsers: Chrome: 125.0.6422.60 Edge: Not Found Safari: 17.4.1 npmPackages: @emotion/react: 11.11.1 @emotion/styled: 11.11.0 @mui/base: 5.0.0-beta.32 @mui/core-downloads-tracker: 5.15.5 @mui/icons-material: ^5.15.5 => 5.15.5 @mui/lab: ^5.0.0-alpha.165 => 5.0.0-alpha.165 @mui/material: ^5.15.5 => 5.15.5 @mui/private-theming: 5.15.5 @mui/styled-engine: 5.15.5 @mui/system: ^5.15.5 => 5.15.5 @mui/types: 7.2.13 @mui/utils: 5.14.18 @mui/x-data-grid: 6.18.7 @mui/x-data-grid-premium: ^6.18.7 => 6.18.7 @mui/x-data-grid-pro: 6.18.7 @mui/x-date-pickers: ^6.19.0 => 6.19.0 @mui/x-license-pro: ^6.10.2 => 6.10.2 @types/react: ^18.0.5 => 18.2.33 react: ^18.2.0 => 18.2.0 react-dom: ^18.2.0 => 18.2.0 styled-components: 5.3.11 typescript: ^5.4.5 => 5.4.5 ```

Search keywords: disableScrollLock

Brian-Azizi commented 5 months ago

@mj12albert @zannager what's the status of this? I'm running into the same issue