Skip to content

isIntersecting definition doesn't match browsers when thresholds are involved. #432

@emilio

Description

@emilio

So the spec says that technically, you're supposed to set isIntersecting to true unconditionally, regardless of threshold:

https://w3c.github.io/IntersectionObserver/#update-intersection-observations-algo:

Let isIntersecting be true if targetRect and rootBounds intersect or are edge-adjacent, even if the intersection has zero area (because rootBounds or targetRect have zero area); otherwise, let isIntersecting be false.

It also says that we should schedule notifications whenever isIntersecting changes, regardless of the threshold change. However that doesn't match browsers, see:

Firefox initially implemented the spec to the letter but had a workaround of sorts to make it similar to other browsers:

Given no browser follows the spec, and that Firefox is pretty close to other browsers, except on the specific value of isIntersecting, I think we should change the spec and Firefox, probably... But it seems kind of an unfortunate situation to be in.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions