Skip to content

[cssom-view] scrollIntoView spec text ("determine the scroll-into-view position") disagrees with browser behavior on which writing-mode(s) to use to determine sides #11796

Open
@dholbert

Description

@dholbert

https://drafts.csswg.org/cssom-view-1/#determine-the-scroll-into-view-position

6.1. Element Scrolling Members
To determine the scroll-into-view position of a target [...]
[...]
Let scrolling box edge A be the beginning edge in the block flow direction of scrolling box, and let element edge A be target bounding border box’s edge on the same physical side [...]
[...]
If block is "start", then align element edge A with scrolling box edge A.

(emphasis added by me)

The spec text there seems to say to use the writing-mode of the scrolling box to decide how to interpret the inline and block options that were passed to scrollIntoView (i.e. how to decide what physical axis/side to use for for "inline: {start/center/end}" etc).

In a situation where there are nested scroll containers, this^ will potentially produce a different axis/edge for each scroll box.

This results in behavior that feels pretty chaotic, as noted in https://bugzilla.mozilla.org/show_bug.cgi?id=1789464#c20 , and it's not what browsers actually do. Chromium, WebKit, and Gecko (in Nightly as of ~today) instead use the writing-mode of the target element to decide what physical axis/side to use; and they use that same answer for all of the nested scroll containers that need to be scrolled.

That seems to be simpler and be more intuitive than what's in the spec. Probably we should update the spec to match that behavior, both because it seems preferable and also to match the reality of what browsers are actually doing.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Regular agenda

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions