norbi123
norbi123

Reputation: 41

React mui - make menu items sticky to select

How to keep mui MenuItem sticky to Select when scrolling down?

Here codesandbox which presents the issue https://codesandbox.io/s/quirky-knuth-5hr2dg?file=/Demo.tsx

Just click on select and start scrolling down. Menu items will go down when you scroll and I would like them to stay with select. When I scroll down menu items should be going up and eventually disappearing as select does

Upvotes: 0

Views: 712

Answers (1)

Hamidreza
Hamidreza

Reputation: 1565

The menu items are contained within a dialog element identified by the id menu-. The dialog is set to have a fixed position, which means it remains visible even when scrolling. To achieve this effect, you can apply the following CSS class instead:

#menu- {
  position: absolute;
}

Upvotes: 1

Related Questions