-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
fix(overlay): incorrectly calculating centered position on a scrolled page with pushing #13185
fix(overlay): incorrectly calculating centered position on a scrolled page with pushing #13185
Conversation
const smallestDistanceToViewportEdge = | ||
Math.min(viewport.bottom - origin.y, origin.y - viewport.left); | ||
const smallestDistanceToViewportEdge = Math.min( | ||
viewport.bottom - origin.y + viewport.top, origin.y); |
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.
Why isn't this Math.min(viewport.bottom - origin.y, origin.y - viewport.top);
?
Also, prefer breaking at the higher syntactic level (like it was before)
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.
Because that ends up including the scroll position again which throws off the position on a scrolled page.
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.
Could you expand the comment the call that out here?
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.
Done. Also fixed up the line break.
… page with pushing Fixes a centered flexible overlay with pushing, on a scrolled page, not calculating the position properly. There were a couple of issues: * We were using the `top` viewport offset to calculate along the X axis, as well as `left` to calculate along Y. * We weren't accounting correctly for the scroll position. Fixes angular#11868.
6469e37
to
107cab7
Compare
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.
LGTM
… page with pushing (angular#13185) Fixes a centered flexible overlay with pushing, on a scrolled page, not calculating the position properly. There were a couple of issues: * We were using the `top` viewport offset to calculate along the X axis, as well as `left` to calculate along Y. * We weren't accounting correctly for the scroll position. Fixes angular#11868.
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Fixes a centered flexible overlay with pushing, on a scrolled page, not calculating the position properly. There were a couple of issues:
top
viewport offset to calculate along the X axis, as well asleft
to calculate along Y.Fixes #11868.