- From: Alexander Chudesnov via GitHub <noreply@w3.org>
- Date: Thu, 14 Aug 2025 15:21:13 +0000
- To: public-css-archive@w3.org
I agree that, given how the actual [scroll target into view steps](https://drafts.csswg.org/cssom-view/#scroll-a-target-into-view) are defined, the relationship between the Element interface extension and the internal behavior could be improved.
To remove ambiguity from the spec (setting a variable called `container` to the element which isn't itself _containing_ anything for the purposes of the method), the following changes could be made:
for `.scrollIntoView(...)`:
| Before | After |
| ------ | ------|
| 4. Let _container_ be null. | Let _container_ be "all". |
| If the **container** dictionary member of options is "nearest", set _container_ to the element. | Set _container_ to the **container** dictionary member of options.|
The `container`'s enum definition could probably be renamed to be more self-descriptive, as right now it kind of points to itself instead (`dictionary ScrollIntoViewOptions { ScrollIntoViewContainer container = ...; }`:
```WebIDL
enum ScrollingBoxScope { "all", "nearest" };
enum ScrollLogicalPosition { "start", "center", "end", "nearest" };
dictionary ScrollIntoViewOptions : ScrollOptions {
ScrollLogicalPosition block = "start";
ScrollLogicalPosition inline = "nearest";
ScrollingBoxScope container = "all";
};
```
Then, in the scroll into view steps:
| Before | After |
| ------ | ------|
| with a scroll behavior _behavior_, a block flow direction position _block_, an inline base direction position _inline_, and an optional containing Element to stop scrolling after reaching _container_ | with a scroll behavior _behavior_, a block flow direction position _block_, an inline base direction position _inline_, and a scrolling box scope _container_ |
| If _container_ is not null and either scrolling box is a shadow-including inclusive ancestor of _container_ or is a viewport whose document is a shadow-including inclusive ancestor of _container_, abort the rest of these steps. | If `container` is "nearest" and either _scrolling box_ is a shadow-including inclusive ancestor of _target_ or is a viewport whose document is a shadow-including inclusive ancestor of _target_, abort the rest of these steps. |
--
GitHub Notification of comment by Chudesnov
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/12260#issuecomment-3188850592 using your GitHub account
--
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Thursday, 14 August 2025 15:21:14 UTC