-
-
Notifications
You must be signed in to change notification settings - Fork 32k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Popper] Position shift when the scroll is blocked #37207
Comments
Thanks for reporting this. I'll look into it. |
The logic would have to be more complicated than just adding |
Yeah, my main concern here is the fix is not obvious at all 🙂
Out of curiosity, what issues did it cause? |
This sounds to me like the correct way to fix this. I'm not aware of anything else needed. But yes, maybe the Popper should be smart about it and be able to reposition itself automatically, so a bug? I think that there could be a docs issue as well, maybe we would want to remove as much as possible from https://mui.com/material-ui/react-modal/ and link back to https://mui.com/base/react-modal/#overflow-layout-shift starts to explain the solution. A demo there would be nice as well. |
@cherniavskii, the new Popup from Base UI does not suffer from this issue (unless I missed something): https://codesandbox.io/s/friendly-noyce-dd3r2d?file=/demo.tsx |
@michaldudak Yes, I confirm that the |
Would using the Popup instead of Popper be a good workaround in your use case? We're planning to deprecate the Popper in the future, so I'm not keen on investing time to fix its bugs. |
We're currently using the |
Duplicates
Latest version
Steps to reproduce 🕹
Link to live example: https://codesandbox.io/s/loving-fast-7scfjf?file=/demo.tsx
Steps:
Current behavior 😯
When
Popper
has*-end
placement, its position shifts when the scroll is blocked:Screen.Recording.2023-05-08.at.12.09.01.mov
Expected behavior 🤔
Popper
's position should not shift (it doesn't when the placement is changed to*-start
):Screen.Recording.2023-05-08.at.12.09.14.mov
Context 🔦
We noticed this in MUI X mui/mui-x#6619 (comment)
The issue can be solved with the
mui-fixed
className applied to thePopper
:Demo: https://codesandbox.io/s/hidden-breeze-92jzki?file=/demo.tsx
But we can make this fix unnecessary by applying
mui-fixed
automatically when theplacement
is set to*-end
.Your environment 🌎
npx @mui/envinfo
The text was updated successfully, but these errors were encountered: