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

The CSS Working Group just discussed `[cssom-view-1] Option for scrollIntoView that doesn't propagate to ancestors`, and agreed to the following:

* ``RESOLVED: enum ScrollIntoViewContainer { "all", "nearest" }, defaulting to `all`, expanding to element in the future if needed``

<details><summary>The full IRC log of that discussion</summary>
&lt;joshtumath> flackr: scrollIntoView is a useful API<br>
&lt;joshtumath> ... does the right thing for common use cases. but propogates all the way up chain to scroll root<br>
&lt;joshtumath> ... so the proposal is to add a container property to the dict added to scrollIntoView<br>
&lt;joshtumath> ... it would use Tab's proposal here for the common ancestor about what to scroll into view<br>
&lt;joshtumath> ... the main reason was to make it easy to refer to your own scrolling ancestor.<br>
&lt;joshtumath> ... so you'd say container.target and it would refer to nearest ancestor<br>
&lt;emilio> q+<br>
&lt;joshtumath> ... I'm also fine with it just using the container. but then we have to answer what happens if the container is not actually an ancestor<br>
&lt;joshtumath> ... you could just do nothing because that's what you've asked for<br>
&lt;joshtumath> ... TabAtkin's suggestion is simple to use, but container is not quite the right name<br>
&lt;joshtumath> Rossen: the top scrolling ancestor of the container?<br>
&lt;smfr> q+<br>
&lt;TabAtkins> X.scrollIntoView(container:Y), finds the nearest common scollable ancestor of X and Y<br>
&lt;Rossen5> ack emilio<br>
&lt;joshtumath> emilio: I think I was going to drop a similar question. Ancestor in the DOM sense or layout tree sense?<br>
&lt;joshtumath> ... or maybe we need to... we have a switch to not scroll<br>
&lt;joshtumath> ... I think what you want is to scroll to the first scrollable thing<br>
&lt;joshtumath> ... let's say you have a fixedpos element<br>
&lt;joshtumath> ... it does not scroll with the rest of the content<br>
&lt;joshtumath> flackr: it would follow the scroll parent chain?<br>
&lt;joshtumath> emilio: a layout ancestor.<br>
&lt;joshtumath> ... so let's say if you scroll it on a popover.<br>
&lt;joshtumath> ... that seems reasonable, but container is a misnomer. maybe scroll-parent?<br>
&lt;joshtumath> ...but we have the scroll parent API<br>
&lt;bramus> https://github.com/w3c/csswg-drafts/issues/1522 is that issue<br>
&lt;joshtumath> flackr: we have a separate issue to add scroll parent to the element API<br>
&lt;joshtumath> ... we have offset parent, which is close<br>
&lt;joshtumath> emilio: Should we add something to skip over overflow: hidden stuff, but I can see you want both<br>
&lt;joshtumath> bramus: they should use overflow: clip in that case<br>
&lt;Rossen5> ack smfr<br>
&lt;joshtumath> smfr: I agree with emilio. Should shadow roots be a boundary as well?<br>
&lt;joshtumath> ... and at least in WebKit, scrolling goes across iframe boundaries<br>
&lt;emilio> q+<br>
&lt;joshtumath> ... it surprises me because ???<br>
&lt;joshtumath> flackr: I thought chrome changed that to not propergate across iframe boundaries.<br>
&lt;joshtumath> argyle: on codepen, the reproduce ability is available<br>
&lt;joshtumath> ... you'll see the iframe scroll into view and you'll know it's the child iframe. it's kind of the issue<br>
&lt;joshtumath> smfr: I have a feeling that's cross origin. maybe I'm thinking of jsbin<br>
&lt;joshtumath> bramus: yes I think so<br>
&lt;smfr> if Chrome did change the cross-origin iframe behavior, I'd like that to be raised in a CSS issue and specified<br>
&lt;joshtumath> Rossen: but the point is righteous. allowing to escape iframes or cross-origin iframes, sounds like reasonably in scope<br>
&lt;joshtumath> flackr: I think it's a different issue<br>
&lt;bramus> +1 on it being a different issue<br>
&lt;argyle> +1, two great different issues we should fix<br>
&lt;joshtumath> ... the issue of smfr is iframes, it's scrolling and hijacking frames that are unrelated.<br>
&lt;joshtumath> Rossen: but should be tackled in a separate issue. very related<br>
&lt;Rossen5> ack emilio<br>
&lt;joshtumath> emilio: so we could still at least agree that this doesn't work when the container you pass in comes from a separate document<br>
&lt;joshtumath> ... smfr had a question about shadow root<br>
&lt;joshtumath> ... they don't have boxes so they don't apply here?<br>
&lt;joshtumath> ... depending on how we do this, scroll parent API has to retarget stuff from inside to outside shadow trees<br>
&lt;joshtumath> ... the scroll only on the first ancestor would get you ???<br>
&lt;joshtumath> ... so i wonder if we should do more research for that situation<br>
&lt;joshtumath> ... the closest scroller, if it's in the shadow tree, do you want the container inside your tree<br>
&lt;joshtumath> ... I don't think you want to get it without conversions, to get an element from a shadow tree<br>
&lt;joshtumath> flackr: I guess in a way, you can scroll up to the ????<br>
&lt;argyle> q+<br>
&lt;joshtumath> emilio: you need a way of avoiding scroll parent in the shadow root<br>
&lt;joshtumath> ... that may be an issue with shadow parent rather than this issue<br>
&lt;joshtumath> flackr: we should have an API for that that expands to specifying a container in the future<br>
&lt;bramus> q+<br>
&lt;Rossen5> ack argyle<br>
&lt;joshtumath> argyle: 100+ on this. it makes scrollIntoView unusable because of the side effects<br>
&lt;emilio> maybe we have an enum Container { "all", "first" }, then optionally make it `(Container or Element) container;` in the future<br>
&lt;joshtumath> ... maybe tag the containers with CSS. we indicate a scroll into view mechanism<br>
&lt;emilio> q+<br>
&lt;flackr> I would say nearest instead of first<br>
&lt;joshtumath> ... then you declare on any container that you know of.<br>
&lt;joshtumath> flackr: I disagree because that would change things like scrolling to an anchor link<br>
&lt;emilio> q-<br>
&lt;joshtumath> ... could spec it not to but maybe it would be weird, affect some APIs not others<br>
&lt;joshtumath> ... agree with emilio's suggestion changing first to nearest<br>
&lt;joshtumath> emilio: sounds good<br>
&lt;joshtumath> bramus: could have default value being document root element<br>
&lt;joshtumath> ... as smfr said in IRC, could continue this at F2F<br>
&lt;joshtumath> flackr: that could be breaking. we could change what all does<br>
&lt;joshtumath> Rossen: I want to see if we can resolve<br>
&lt;joshtumath> ... instead of deferring to F2F<br>
&lt;flackr> Proposed resolution: Add container: 'all' | 'nearest' with default value 'all'<br>
&lt;joshtumath> ... we can agree to adopt it as currently specified<br>
&lt;emilio> PROPOSED: enum ScrollIntoViewContainer { "all", "nearest" }, defaulting to `all`, expanding to element in the future if needed<br>
&lt;joshtumath> flackr: scroll parent ancestry<br>
&lt;joshtumath> emilio: not if the block is not scrollable<br>
&lt;joshtumath> smfr: does it work in the popover case?<br>
&lt;joshtumath> emilio: it would scroll the viewport, but that would be outside of the scroller<br>
&lt;joshtumath> ... we should define this so that it works properly in that case.<br>
&lt;joshtumath> smfr: OK<br>
&lt;joshtumath> Rossen: sounds like it's resolved<br>
&lt;joshtumath> RESOLVED: enum ScrollIntoViewContainer { "all", "nearest" }, defaulting to `all`, expanding to element in the future if needed<br>
&lt;emilio> We should probably follow-up with issues for iframe and overflow-hidden tweaks<br>
</details>


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


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

Received on Wednesday, 22 January 2025 17:44:41 UTC