-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
resources-impl: fix alwayFixed #30627
Conversation
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 think this is ok as a bug plug while we are reviewing all measurements anyway. But need tests 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.
Thanks for quick resolution Jake!
I put this back in draft mode because I'm seeing some issues with the current solution :(. Investigating now |
Argh. Yep. It is possible (especially in this example with scroll: Theres no way around performing a remeasure. |
Can you actually reproduce with something like amp-user-notification? For amp-analytics, amp-state, and amp-bind-macro, I'd rather we just remove this |
I haven't tried, but the logic is the same. When the measure happens before upgrade, then any fixed element may have its rect incorrect (esp. during a scroll event).
I agree! In the PR description I actively called out the desire to replace the existing method with a flag like the one you mention ( |
@jridgewell: 🏓 |
* resources-impl: fix always fixed * unit test * alternative / better fix * better comment
Fixes #30379.
Affected components:
Root cause is related to
intersect-resources
experiment. Since measurement can (and often will) occur before the extension loads, measurement is then done while still a stub. At that moment,isAlwaysFixed
is always false.Therefore layoutBox computations were not adjusted for
position:fixed
and components would not be laid out. Band-aid fix in this PR is to recompute measurements once the extension loads using the same computed rect as earlier (but now taking the fixed position into account).Future work: instead of relying upon some notion like
isAlwaysFixed
, we should have a simpler flag forshouldAlwaysLayout
that doesn't need to fan out into more computations