-
Notifications
You must be signed in to change notification settings - Fork 1.4k
fix(overlays): cap visualViewport width at clientWidth to handle scrollbar gutter #9275
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
base: main
Are you sure you want to change the base?
fix(overlays): cap visualViewport width at clientWidth to handle scrollbar gutter #9275
Conversation
| // if (width > documentElement.clientWidth) { | ||
| // width = documentElement.clientWidth; | ||
| // } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should probably be rounded to account for sub-pixel differences when zooming.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't it be ceil? or floor? I don't quite follow what the concern is here though
also, this doesn't need to be an if, can be
width = Math.min(Math.round(width), documentElement.clientWidth)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Concern were false-positives in general. I did not take a deeper look at the underlying issue before, but in this case false-positives could result in a tiny gap between the overlay and scrollbar, right? Maybe that's acceptable though - certainly better than cutting content off 🤷
On Firefox & Chrome the clientWidth appears to correspond to Math.round, but Safari apparently uses some other heuristic, neither floor nor ceil.
…utter' into fix/popover-position-scrollbar-gutter
Closes #9199
✅ Pull Request Checklist:
📝 Test Instructions:
🧢 Your Project: