-
Notifications
You must be signed in to change notification settings - Fork 1.5k
fix: overlay layout shift when auto-focusing input #10102
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?
Changes from all commits
13eafc2
64a2d76
8bf7085
2ed61d1
522b02e
c9fbf32
c93b460
9bcbdf4
2d6fc45
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| export {runAfterKeyboard, runAfterKeyboardTransition} from '../../../src/utils/runAfterKeyboard'; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -336,8 +336,9 @@ function getMaxHeight( | |
| (position.top != null | ||
| ? position.top | ||
| : containerDimensions[TOTAL_SIZE.height] - (position.bottom ?? 0) - overlayHeight) - | ||
| (containerDimensions.scroll.top ?? 0); | ||
| // calculate the dimentions of the "boundingRect" which is most restrictive top/bottom of the boundaryRect and the visual view port | ||
| (containerDimensions.scroll.top ?? 0) + | ||
| (visualViewport?.offsetTop ?? 0); | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @snowystinger This was the core culprit to the positional issue. A scroll into view motion may divide delta between container scroll and viewport scroll, but only the former was accounted for. See this animation for an explainer https://www.w3.org/TR/cssom-view-1/#example-vvanimation |
||
| // calculate the dimensions of the "boundingRect" which is most restrictive top/bottom of the boundaryRect and the visual view port | ||
| let boundaryToContainerTransformOffset = isContainerDescendentOfBoundary | ||
| ? containerOffsetWithBoundary.top | ||
| : 0; | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this 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.
I'm slightly concerned about user land style, when transitions are used for enter animation. Now that entering is delayed by at least a frame, users should be adding something like this to avoid a flash of content. This would be an existing issue in our Popover example styling as well, due opacity not being 0 while awaiting placement, if it were not for the early resize in Popover's layout effect.
I haven't thought of a way to avoid this without forcing an opinionated hidden inline style. Maybe somebody else got ideas?