Intent to Prototype: HTMLElement.scrollParent

133 views
Skip to first unread message

Chromestatus

unread,
Jun 20, 2025, 10:23:38 AMJun 20
to blin...@chromium.org, fla...@chromium.org

Contact emails

fla...@chromium.org

Explainer

None

Specification

https://drafts.csswg.org/cssom-view/#dom-htmlelement-scrollparent

Summary

The scrollParent attribute on HTMLElement returns the nearest scroll container containing block of the element's. In particular this is the nearest scroll container whose scroll offset affects the element's position. This can be useful to jump to elements to scroll or to elements on which to add scroll listeners to detect when the user scrolls.



Blink component

Blink>Scroll

Motivation

Developers have to check a number of conditions to determine if an element is a scroll container and correctly walking the containing block chain can be tricky to get correct. Having scrollParent will allow developers to jump right to the correct container on which to add scroll event listeners and/or call scrolling API's in order to effect the target element's scroll position or use those scrolling offsets on other elements.



Initial public proposal

https://github.com/w3c/csswg-drafts/issues/1522

TAG review

None

TAG review status

Pending

Risks



Interoperability and Compatibility

None



Gecko: No signal

WebKit: No signal

Web developers: Positive (https://github.com/w3c/csswg-drafts/issues/1522)

Other signals:

Activation

It is possible to write a reasonable polyfill for this API and start using it immediately with a fallback implementation.



Security

There are no known security risks to this API.



WebView application risks

Does this intent deprecate or change behavior of existing APIs, such that it has potentially high risk for Android WebView-based applications?

None



Debuggability

This doesn't need any debugging support, and in fact is helpful for developers to debug their content when using CSS features which rely on the nearest scrolling container such as position sticky.



Is this feature fully tested by web-platform-tests?

No

Flag name on about://flags

Experimental web platform features

Finch feature name

HTMLElementScrollParent

Requires code in //chrome?

False

Estimated milestones

No milestones specified



Link to entry on the Chrome Platform Status

https://chromestatus.com/feature/5132203583078400?gate=5144978694864896

This intent message was generated by Chrome Platform Status.
Reply all
Reply to author
Forward
0 new messages