Skip to content

[css-scroll-anchoring-1] Anchor selection algorithm can lead to random results #4124

@bzbarsky

Description

@bzbarsky

The way that https://drafts.csswg.org/css-scroll-anchoring/#anchoring-algorithm works is:

  1. Walk the child nodes of our scrollable thing.
  2. Stop when we find one that meets certain criteria.

The thing is, the algorithm doesn't say what order the child nodes are walked in. As far as I can tell, you can walk them forwards, backwards, or in any random order, and those would all be spec-compliant.

Note that just walking in DOM order from start to end may not be the right thing either; e.g. if the parent is a grid the earlier DOM kids may not be the thing you want to anchor at because they are further from the block start edge than later kids are.

@emilio @skobes

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions