Closed Bug 1677644 Opened 4 years ago Closed 4 years ago

IntersectionObserver with document root produces incorrect intersection rects for subframe targets

Categories

(Core :: CSS Parsing and Computation, defect)

Firefox 82
defect

Tracking

()

RESOLVED INVALID

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:

  1. Open https://output.jsbin.com/somucum/quiet
  2. 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.

Bugbug thinks this bug should belong to this component, but please revert this change in case of error.

Component: Untriaged → DOM: Core & HTML
Product: Firefox → Core

(I can't recall now where IntersectionObserver bugs belong to. Layout or CSS?)

Component: DOM: Core & HTML → CSS Parsing and Computation

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.

Assignee: nobody → emilio
Status: UNCONFIRMED → NEW
Ever confirmed: true
Flags: needinfo?(emilio)

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?

Assignee: emilio → nobody
Flags: needinfo?(emilio) → needinfo?(dvoytenko)

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.

Thanks for checking Stefan :)

Status: NEW → RESOLVED
Closed: 4 years ago
Flags: needinfo?(dvoytenko)
Resolution: --- → INVALID

However, the non-intersecting record is not reported either. No observations reported at all.

Which version did you test? I see the non-intersecting record on Nightly.

Flags: needinfo?(dvoytenko)

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

Confirmed against nightly and indeed the non-intersecting values are reported. Thanks!

Flags: needinfo?(dvoytenko)
You need to log in before you can comment on or make changes to this bug.