mui / mui/material-ui

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

Open
#42,323 1 comment 0 reactions 1 assignee View on GitHub

Nobody has claimed this yet.

scope: menu scope: select
Dominant language
JavaScript
Stars
99.1k
Forks
32.5k
Avg merge
2d 17h
Merged PRs (30d)
106

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.