Re: [csswg-drafts] [cssom-view-1] Option for scrollIntoView that doesn't propagate to root (#9452)

There's some corner cases to consider:

1. What's the behavior if the indicated container isn't a scroll container?
2. What's the behavior if the indicated element isn't an ancestor of the target?

We *could* make both of those be an error, but I think there's an easy option that solves both: find the nearest scroll container inclusive ancestor of the given "container" element which contains the target as a descendant.

This way, specifying a non-scrolling ancestor isn't an error, it'll just move up the tree until it finds something it can scroll. And specifying a non-ancestor isn't an error, it'll just move up the tree until it finds a common ancestor (possibly the root scroller).

(This also happens to avoid the dependency on `.scrollParent`, as you could just supply the target itself as the "container" to auto-select its nearest scrollable ancestor. But I do think we should pursue `.scrollParent` as well; it's useful for more than just this, and is less hacky-feeling for this use-case even if it would be technically unnecessary.)

-- 
GitHub Notification of comment by tabatkins
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/9452#issuecomment-2486918244 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Tuesday, 19 November 2024 22:56:42 UTC