Skip to content

[css-anchor] Interaction between anchor-scroll and position: sticky is not well defined #8448

@xiaochengh

Description

@xiaochengh

The current spec takes a snapshotted scroll offset of the anchor element.

When the anchor has position:sticky and is stuck, this offset no longer matches the actual offset of the anchor element. Then both position-fallback and anchor-scroll fail.

Test case (by @jh3y): https://codepen.io/web-dot-dev/pen/dyqbqjE/8b6fc20f812f33ba4920620bb9af3604


Edit: there's another case when we have an anchor-scrolled container with sticky positioned content

Test case: https://jsfiddle.net/p7nfqyzw/

The tooltip should be stuck when hitting the top of the viewport, but currently it doesn't.

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