Re: [w3ctag/design-reviews] ScrollIntoViewOptions container attribute (Issue #1105)

kurtextrem left a comment (w3ctag/design-reviews#1105)

Hi, 
I really love this new option, as scrollIntoView's scroll hijacking behavior has bitten me in the past too (so I also think this solves a real big problem of the web platform). I have one request though:

> Detection of the feature can be done in Javascript by doing a test scrollIntoView, and if done in a position: fixed descendant should prevent highjacking the user's scroll.

Could you please add an example for that? I assume you're thinking something like `<div style="position:fixed;top:1px"><div id="scrollToThis">`, then calling `window.scrollToThis.scrollIntoView({ container: 'nearest' })` on page load. If `window.scrollY === 0` it is supported, otherwise it isn't?
Asking, because having a copy & paste-able example would make it easier for both humans and AI agents to adopt this :)

-- 
Reply to this email directly or view it on GitHub:
https://github.com/w3ctag/design-reviews/issues/1105#issuecomment-3323968554
You are receiving this because you are subscribed to this thread.

Message ID: <w3ctag/design-reviews/issues/1105/3323968554@github.com>

Received on Tuesday, 23 September 2025 13:14:24 UTC