Skip to content

[cssom-view-1] Define HTMLElement.scrollParent #12177

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

flackr
Copy link
Contributor

@flackr flackr commented May 9, 2025

Define the scrollParent of an element following the discussion and resolution in #1522.

Define the scrollParent of an element following the discussion and resolution in w3c#1522.
@flackr flackr requested a review from tabatkins May 20, 2025 13:47
@tabatkins
Copy link
Member

tabatkins commented May 20, 2025

Hm, it's slightly unfortunate that a null can mean either that the scroll parent is the root scroller, or that the scroll parent is hidden in a closed shadow. The former can still be responded to, by scrolling the root, the latter can't be, and I'm not sure there's an easy way to tell them apart.

Is that okay? Or do we want to be able to distinguish those cases?

Edit: Well I guess the third case is that it's a fixpos, which skips all the scrollers anyway and just attaches to the viewport, and thus isn't scrollable either. Hm.

@flackr
Copy link
Contributor Author

flackr commented May 20, 2025

The former can still be responded to, by scrolling the root, the latter can't be, and I'm not sure there's an easy way to tell them apart.

Right, I could see a good argument for skipping the hidden parent. WDYT of just having it keep walking up the containing block chain in that case? I think you're right that scrolling the next scroller up should still provide reasonable behavior. I've updated the steps accordingly. I think skipping the hidden ancestors is similar to offsetParent actually so this just seems generally better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants