RESOLVED WONTFIX 219013
IntersectionObserver with root:document computes subframe intersection incorrectly
https://bugs.webkit.org/show_bug.cgi?id=219013
Summary IntersectionObserver with root:document computes subframe intersection incorr...
Dima Voytenko
Reported 2020-11-16 16:46:50 PST
(1) Open https://output.jsbin.com/somucum/quiet (2) Wait for all observations to be reported This example creates an IntersectionObserver with `{root: top.document}` and observes a target within a same-origin subframe. It's expected that such an IntersectionObserver would return observations similar to an intersection observer configured with `{root: null}`. However, as the repro case shows, it currently returns a non-intersecting observation (`intersectionRatio === 0`).
Attachments
Smoley
Comment 1 2020-11-16 19:07:27 PST
Thanks for filing. This reproduces for me on STP 115 and TOT.
Radar WebKit Bug Importer
Comment 2 2020-11-16 19:08:03 PST
Ali Juma
Comment 3 2020-11-18 06:51:21 PST
WebKit's behavior in this case seems to match the spec as currently written. According to https://www.w3.org/TR/intersection-observer/#intersection-observer-interface: "Any target of an explicit root observer ... must be in the same document as the intersection root." And according to https://www.w3.org/TR/intersection-observer/#update-intersection-observations-algo: "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." Skipping to step 11 means skipping the computation of the intersection. So in Document.cpp, computeIntersectionState() earlies-out if the observer has an explicit root but the target is in a different document. If other browsers are handling this case differently, perhaps the parts of the spec mentioned above need to be updated for the case where the explicit root is the main-frame's document.
Dima Voytenko
Comment 4 2020-11-18 12:08:09 PST
Thanks, Ali! I'll close this for now, until we figure out more about other browsers.
Note You need to log in before you can comment on or make changes to this bug.