IntersectionObserver with document root produces incorrect intersection rects for subframe targets
Categories
(Core :: CSS Parsing and Computation, defect)
Tracking
()
People
(Reporter: dvoytenko, Unassigned)
Details
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.193 Safari/537.36
Steps to reproduce:
- Open https://output.jsbin.com/somucum/quiet
- Wait for observations to be produced
In this example:
a. The intersection observer is created with {root: top.document}
.
b. This intersection observer is used to observe a target in a same-origin iframe.
Actual results:
The IntersectionObserver does not return any observations for a target within the same-origin subframe.
Expected results:
The IntersectionObserver should return the observation for a target within the same-origin subframe. A different intersection observer with {root: null}
returns the observations as expected.
Comment 1•4 years ago
|
||
Bugbug thinks this bug should belong to this component, but please revert this change in case of error.
Comment 2•4 years ago
|
||
(I can't recall now where IntersectionObserver bugs belong to. Layout or CSS?)
Comment 3•4 years ago
|
||
Yeah, root: top.document
shouldn't really be different than no root in the same-origin case, I can poke.
cc fredw which implemented the root: Document bits.
Comment 4•4 years ago
|
||
Actually, I think this is invalid. Per https://w3c.github.io/IntersectionObserver/#run-the-update-intersection-observations-steps:
If the intersection root is not the implicit root, and target is not in the same document as the intersection root, skip to step 11.
Am I missing something?
Emilio -- thank you, as always, for your careful reading of the spec. I think you're right, the observer with {root: top.document} observing the element inside the iframe should always report not-intersecting.
Comment 6•4 years ago
|
||
Thanks for checking Stefan :)
However, the non-intersecting record is not reported either. No observations reported at all.
Comment 8•4 years ago
|
||
Which version did you test? I see the non-intersecting record on Nightly.
Comment 9•4 years ago
|
||
I'm pretty sure we should return the non-intersecting record as per bug 1670327 (Firefox 83), see https://github.com/w3c/IntersectionObserver/issues/457
Reporter | ||
Comment 10•4 years ago
|
||
Confirmed against nightly and indeed the non-intersecting values are reported. Thanks!
Description
•