-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Ensure sibling Dialog
components are scrollable on mobile
#3796
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
Conversation
This is just a very very small optimization, but wanted to optimize it since I noticed it. Essentially `containers.flatMap(resolve => resolve())` is a bit wasteful if we you have `n` containers, but you already found a match in the first container. If that's the case, then we resolved `n-1` containers for nothing. Depending on what we actually do during this resolve step it could be a lot of unnecessary work (e.g.: querying the DOM).
Otherwise we have to build it on every scroll event and that would be very expensive.
The latest updates on your projects. Learn more about Vercel for GitHub.
|
meta() { | ||
return entry.computedMeta | ||
}, |
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 considered making this a getter, but then you have to use entry.meta
instead of destructuring it to prevent the meta
to be evaluated already.
// that happens later can update the meta information. Otherwise we would | ||
// use stale meta information. | ||
meta() { | ||
return entry.computedMeta |
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.
Used entry
instead of destructuring the computedMeta
to ensure we are looking at the latest data. Alternatively we could use this.get(doc).computedMeta
or something
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.
seems fine 🤷♂️
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 know this kind of sounds like the opposite of the above message, but the difference is a getter here vs destructuring in another spot so the connection might not be as clear.
This PR fixes an issue where opening a sibling dialog doesn't allow you to scroll the second (top most) dialog on iOS anymore.
The issue here is that on iOS we have to do a lot of annoying work to make the dialog behave like a dialog and prevent scrolling outside of the dialog.
To make this all work, we PUSH and POP some information to know what the top-most dialog is. The moment there is 1 open dialog, and as long as there is 1 dialog we scroll lock the page, the moment there are 0 dialogs again we unlock the page again.
Each dialog also has a set of "allowed containers", these are just container DOM nodes where we allow scrolling.
But the issue is that we were dealing with stale data. These are the events you see when we open dialogs:
Any time we
PUSH
we also track new meta data with the allowed containers. Butwe were already preventing scroll, so we had stale meta data.
To solve this, I can think of 2 solutions:
Test plan
In both scenario's I first open the dialog, then scroll.
before:
ScreenRecording_09-17-2025.17-18-13_1.MP4
after:
ScreenRecording_09-17-2025.17-18-35_1.MP4
Fixes: #3378