Repository navigation
Resolve IntersectionObserver percentage margins against width (#60332) - #60332
Closed
rubennorte wants to merge 1 commit into
Closed
rubennorte wants to merge 1 commit into
rubennorte wants to merge 1 commit into
Conversation
|
@rubennorte has exported this pull request. If you are a Meta employee, you can view the originating Diff in D134823780. |
…60332) Summary: ## Context The [Intersection Observer specification](https://w3c.github.io/IntersectionObserver/#root-intersection-rectangle) resolves percentage margins on all four edges against the width of the undilated root or scrollport rectangle. For both `rootMargin` and `scrollMargin`, it states: > Percentages are resolved relative to the width of the undilated rectangle. React Native instead resolved top and bottom percentages against height, producing incorrect intersection bounds on non-square rectangles. ## Changes Make `resolveEdgeMargins` take an explicit `referenceLength` instead of a rectangle size, and pass the undilated width at each IntersectionObserver call site. Resolve all percentage edges against that reference while leaving absolute margins and per-scrollport resolution unchanged. Regenerate the C++ API snapshots for the signature change. Clarify the API documentation and extend existing integration coverage for non-square roots, positive and negative margins, scaled and nested scrollports, and combined root and scroll margins. Changelog: [General][Fixed] - Resolve `IntersectionObserver` percentage `rootMargin` and `scrollMargin` values against rectangle width on all sides Differential Revision: D134823780
rubennorte
force-pushed
the
export-D134823780
branch
from
November 27, 2026 15:58
273b4a0 to
13a2077
Compare
javache
approved these changes
Nov 27, 2026
javache
left a comment
Contributor
There was a problem hiding this comment.
Review automatically exported from Phabricator review in Meta.
Member
Author
|
Abandoned as I verified this "bug" exists also in Chrome, Firefox and Safari. Implementing this "bug" for browser compatibility is more valuable than blindly following the spec. |
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.
Summary:
Context
The Intersection Observer specification resolves percentage margins on all four edges against the width of the undilated root or scrollport rectangle. For both
rootMarginandscrollMargin, it states:React Native instead resolved top and bottom percentages against height, producing incorrect intersection bounds on non-square rectangles.
Changes
Make
resolveEdgeMarginstake an explicitreferenceLengthinstead of a rectangle size, and pass the undilated width at each IntersectionObserver call site. Resolve all percentage edges against that reference while leaving absolute margins and per-scrollport resolution unchanged. Regenerate the C++ API snapshots for the signature change.Clarify the API documentation and extend existing integration coverage for non-square roots, positive and negative margins, scaled and nested scrollports, and combined root and scroll margins.
Changelog:
[General][Fixed] - Resolve
IntersectionObserverpercentagerootMarginandscrollMarginvalues against rectangle width on all sidesDifferential Revision: D134823780