Repository: material-ui
Issue: [material-ui][Menu] `disableScrollLock` doesn't work for Select when wrapper's overflow hidden
Labels: component: menu,component: select,package: material-ui

### Steps to reproduce

Link to live example: [Sandbox example](https://codesandbox.io/p/sandbox/objective-hooks-l6s7zs?layout=%257B%2522sidebarPanel%2522%253A%2522EXPLORER%2522%252C%2522rootPanelGroup%2522%253A%257B%2522direction%2522%253A%2522horizontal%2522%252C%2522contentType%2522%253A%2522UNKNOWN%2522%252C%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522id%2522%253A%2522ROOT_LAYOUT%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522UNKNOWN%2522%252C%2522direction%2522%253A%2522vertical%2522%252C%2522id%2522%253A%2522clwg90nrg00073b6iqarwfvlz%2522%252C%2522sizes%2522%253A%255B100%252C0%255D%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522EDITOR%2522%252C%2522direction%2522%253A%2522horizontal%2522%252C%2522id%2522%253A%2522EDITOR%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL%2522%252C%2522contentType%2522%253A%2522EDITOR%2522%252C%2522id%2522%253A%2522clwg90nrf00033b6i9q9srebj%2522%257D%255D%257D%252C%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522SHELLS%2522%252C%2522direction%2522%253A%2522horizontal%2522%252C%2522id%2522%253A%2522SHELLS%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL%2522%252C%2522contentType%2522%253A%2522SHELLS%2522%252C%2522id%2522%253A%2522clwg90nrf00043b6id12ms6s2%2522%257D%255D%252C%2522sizes%2522%253A%255B100%255D%257D%255D%257D%252C%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522DEVTOOLS%2522%252C%2522direction%2522%253A%2522vertical%2522%252C%2522id%2522%253A%2522DEVTOOLS%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL%2522%252C%2522contentType%2522%253A%2522DEVTOOLS%2522%252C%2522id%2522%253A%2522clwg90nrg00063b6i781bk9h5%2522%257D%255D%252C%2522sizes%2522%253A%255B100%255D%257D%255D%252C%2522sizes%2522%253A%255B50%252C50%255D%257D%252C%2522tabbedPanels%2522%253A%257B%2522clwg90nrf00033b6i9q9srebj%2522%253A%257B%2522tabs%2522%253A%255B%257B%2522id%2522%253A%2522clwg90nrf00023b6iovd4m7f5%2522%252C%2522mode%2522%253A%2522permanent%2522%252C%2522type%2522%253A%2522FILE%2522%252C%2522filepath%2522%253A%2522%252Fsrc%252FDemo.tsx%2522%252C%2522state%2522%253A%2522IDLE%2522%252C%2522initialSelections%2522%253A%255B%257B%2522startLineNumber%2522%253A42%252C%2522startColumn%2522%253A10%252C%2522endLineNumber%2522%253A42%252C%2522endColumn%2522%253A10%257D%255D%257D%255D%252C%2522id%2522%253A%2522clwg90nrf00033b6i9q9srebj%2522%252C%2522activeTabId%2522%253A%2522clwg90nrf00023b6iovd4m7f5%2522%257D%252C%2522clwg90nrg00063b6i781bk9h5%2522%253A%257B%2522id%2522%253A%2522clwg90nrg00063b6i781bk9h5%2522%252C%2522activeTabId%2522%253A%2522clwgvyk1k001p3b6igg3v4l75%2522%252C%2522tabs%2522%253A%255B%257B%2522type%2522%253A%2522UNASSIGNED_PORT%2522%252C%2522port%2522%253A0%252C%2522id%2522%253A%2522clwgvyk1k001p3b6igg3v4l75%2522%252C%2522mode%2522%253A%2522permanent%2522%252C%2522path%2522%253A%2522%252F%2522%257D%255D%257D%252C%2522clwg90nrf00043b6id12ms6s2%2522%253A%257B%2522tabs%2522%253A%255B%255D%252C%2522id%2522%253A%2522clwg90nrf00043b6id12ms6s2%2522%257D%257D%252C%2522showDevtools%2522%253Atrue%252C%2522showShells%2522%253Afalse%252C%2522showSidebar%2522%253Atrue%252C%2522sidebarPanelSize%2522%253A15%257D) (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](https://github.com/mui/material-ui/assets/25950587/070c841e-cbb6-4b33-9b8c-a8eabce6fbef)
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

<details>
  <summary><code>npx @mui/envinfo</code></summary>

```
  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 
```
</details>


**Search keywords**: disableScrollLock