Fixed layout shift issue when Portal popup appears#21895
Merged
minimaluminium merged 3 commits intomainfrom Dec 17, 2024
Merged
Fixed layout shift issue when Portal popup appears#21895minimaluminium merged 3 commits intomainfrom
minimaluminium merged 3 commits intomainfrom
Conversation
sagzy
approved these changes
Dec 17, 2024
Contributor
sagzy
left a comment
There was a problem hiding this comment.
LGTM! Added a comment for a tiny optimisation, but feel free to ignore :)
apps/portal/src/App.js
Outdated
| const scrollbarWidth = outer.offsetWidth - inner.offsetWidth; | ||
|
|
||
| // Clean up | ||
| outer.parentNode.removeChild(outer); |
Contributor
There was a problem hiding this comment.
Small improvement idea: use clientWidth instead of creating an inner element:
...
document.body.appendChild(div);
const scrollbarWidth = div.offsetWidth - div.clientWidth;
document.body.removeChild(div);
...
Contributor
|
Thanks for this fix! I mentioned the issue a couple of years ago on the forum (along with my piss-poor fix), but it apparently couldn't be reproduced for some reason. Your code looks far superior than mine, so I'll remove my code from the sites I've inserted it into as soon as the fix goes live. :) |
Member
Author
|
@stromfeldt Your suggested solution is very simple and nice, however, the only thing with it was we still wanted to lock the vertical scrolling when the popup is open. |
This was referenced Mar 18, 2025
minimaluminium
pushed a commit
that referenced
this pull request
Jul 30, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ref DES-547