Skip to content

Conversation

@Zache
Copy link
Contributor

@Zache Zache commented Dec 2, 2025

This PR resolves an issue with to how the scrollbar is measured to prevent a horizontal shift that can happen to elements when applying the scroll lock for certain window sizes and zoom levels.

How to reproduce the scrollbar zoom issue?
(I'm using Windows 11 and Edge with 100% UI scaling in Windows.)

We can use the mui docs (for example Modal)

  1. Open the dev tools so that you can easily know the exact window size, and change it to be 1200px wide (it doesn't have to be exact but the problem only occurs for some zoom level and window width combinations)
  2. Zoom out to 90%
  3. Trigger a scroll lock, I click the little ⋮ icon at the top of each Demo
  4. You should see the "Post a comment" icon shift, and also the search bar and following icons in the AppBar
  5. Without resizing the window change the zoom level to 80%
  6. Now things act as desired, same for 75%, but it goes wrong for 67%

I have not been able to reproduce the issue for all zoom levels, but for various widths the problem occurs for the following zoom levels: 67%, 80%, 90%, 110%, 175%

@mui-bot
Copy link

mui-bot commented Dec 2, 2025

Netlify deploy preview

https://deploy-preview-47408--material-ui.netlify.app/

Bundle size report

Bundle Parsed size Gzip size
@mui/material 🔺+340B(+0.07%) 🔺+131B(+0.09%)
@mui/lab 0B(0.00%) 0B(0.00%)
@mui/system 0B(0.00%) 0B(0.00%)
@mui/utils 🔺+340B(+2.65%) 🔺+117B(+2.32%)

Details of bundle changes

Generated by 🚫 dangerJS against 3900765

@zannager zannager added the scope: modal Changes related to the modal. label Dec 3, 2025
@zannager zannager requested a review from mj12albert December 3, 2025 15:35
@ZeeshanTamboli ZeeshanTamboli changed the title [material-ui] Take browser zoom into account then calculating scrollbar size [material-ui] Take browser zoom into account when calculating scrollbar size Dec 4, 2025
Copy link
Member

@ZeeshanTamboli ZeeshanTamboli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Zache Thanks for the PR. The rule is to separate out into two different PRs when doing two changes, even if they're minor.

@Zache
Copy link
Contributor Author

Zache commented Dec 5, 2025

Ok, I figured since they both resolve issues that occur with the scroll lock that they could go in together.

@Zache
Copy link
Contributor Author

Zache commented Dec 5, 2025

I split out the padding-right change to #47420

Copy link
Member

@ZeeshanTamboli ZeeshanTamboli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Zache Can you provide a screen-recording showing the issue? I tried your steps on Windows 10 and Chrome browser but I was unable to reproduce it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope: modal Changes related to the modal.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants