Skip to content

[css-scroll-anchoring-1] Can anchor node be an inline-block? #4247

Closed
@emilio

Description

@emilio

If you go to this test-case, then scroll so that the red box is only partially visible, then click it, what should happen?

Firefox and Chrome disagree on this one, and I think Firefox is right per spec. However the user expected Chrome's behavior.

In particular:

  • Firefox chooses the text as the scroll anchor, and thus when the box grows the text keeps its position relative to the viewport.

  • Chrome seems to choose the red box as an anchor, and thus when it grows it moves the text down.

I think per spec Firefox is right. https://drafts.csswg.org/css-scroll-anchoring/#anchor-node-selection says:

The anchor node is either a non-anonymous block box or a text node.

Where block box is https://drafts.csswg.org/css-display-3/#block-box. An inline-block element is clearly not a "block box" (its display outside is inline), so the next eligible anchor node is the text.

However it seems Chromium does select inline-blocks as anchor nodes?

Is this an oversight in the specification, or a bug in Chromium?

cc @skobes @eqrion @dholbert

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions