Re: [csswg-drafts] [css-scroll-snap-1] Snap area trapping behavior of non scrollable elements (#4496)

The CSS Working Group just discussed `scroll-snap`.

<details><summary>The full IRC log of that discussion</summary>
&lt;fremy> Topic: scroll-snap<br>
&lt;astearns> github: https://github.com/w3c/csswg-drafts/issues/4496<br>
&lt;fremy> florian: a while back we resolve the layout containment traps snapping<br>
&lt;fremy> florian: but it's not clear to me as to what spec should define this behavior<br>
&lt;fremy> florian: I don't think that css-contain should contain all the rules in details for all the other specs<br>
&lt;fremy> florian: I would rather this be added to the snapping spec, because this is where you are most likely to need this<br>
&lt;fremy> florian: but in this particular case<br>
&lt;fremy> florian: scroll snapping discovered a whole class of things we forgot to mention<br>
&lt;florian> The content, layout, or scroll position of an element with scroll containment or any of its descendants must not affect the scroll position of any box that is not a descendant of containing box for layout containment.<br>
&lt;fremy> florian: so I would like to suggest an edit<br>
&lt;fremy> florian: (just typed it above)<br>
&lt;fremy> florian: an example would be scroll synchronization or scroll locking<br>
&lt;astearns> s/of containing/of the containing/<br>
&lt;astearns> (I think)<br>
&lt;fremy> florian: like if you scroll one, the other follows<br>
&lt;fremy> florian: but if you contain the layout, this probably shouldn't work<br>
&lt;fremy> florian: i think this should be specified further in scroll-snap<br>
&lt;fremy> florian: because this slows down the progress of containment<br>
&lt;fremy> florian: and I would rather not<br>
&lt;astearns> ack dbaron<br>
&lt;fremy> dbaron: two contains<br>
&lt;fremy> dbaron: you wrote "scroll containment"<br>
&lt;fremy> dbaron: did you mean to write that?<br>
&lt;dbaron> s/contains/questions/<br>
&lt;fremy> dbaron: is that a new type of containment?<br>
&lt;fremy> florian: no, its wrong.<br>
&lt;fremy> florian: I meant layout containment, good catch<br>
&lt;fremy> dbaron: second question then<br>
&lt;fremy> dbaron: the text seems to imply that if you use the #hash part of the url to target an element, then if it is inside something that has layout containment<br>
&lt;fremy> dbaron: it shouldn't work<br>
&lt;fremy> dbaron: but I don't see why<br>
&lt;fremy> florian: I didn't mean to say that<br>
&lt;fremy> florian: I should fix the text if that incorrectly conveys that meaning<br>
&lt;fremy> fantasai: I would also argue that scroll is not layout<br>
&lt;fremy> TabAtkins: but you need some layout to know what is scrollable<br>
&lt;fremy> florian: but you don't need the layout for the effect<br>
&lt;fremy> florian: I agree it's not strictly layout<br>
&lt;fremy> florian: but you can't delay recomputing a subtree if you have these interactions<br>
&lt;fremy> astearns: so if I understand your proposed text would add further requirements on layout containment<br>
&lt;fremy> astearns: if we don't that means that scroll effects would be have side-effects of forcing layout<br>
&lt;fremy> florian: yes, but we can remove from scroll-snapping all cases we don't like<br>
&lt;fremy> florian: that said, of course, if you focus from js etc then you will have to do layout anyway<br>
&lt;fremy> florian: and that seems reasonable<br>
&lt;fremy> florian: this is "contain" property, not "isolate"<br>
&lt;fremy> florian: I think we mostly want to limit interactions, not especially outside>inside interactions<br>
&lt;fremy> TabAtkins: no<br>
&lt;fremy> TabAtkins: the containment is mostly from the layout perspective, the rest of the page is still allowed to affect<br>
&lt;fremy> fantasai: I think scroll and layout in general are two different things<br>
&lt;fremy> fantasai: maybe we should have a "scroll" containment not bundled in layout containment<br>
&lt;fremy> fantasai: this might need a bit more thought<br>
&lt;fremy> florian: implementors, what's your opinion?<br>
&lt;fremy> florian: is scrolling more like paint, or more like layout?<br>
&lt;fremy> fantasai: well, if you have a widget with 10 elements in it<br>
&lt;fremy> fantasai: and I contain their layout<br>
&lt;fremy> fantasai: for perf reasons<br>
&lt;fremy> fantasai: but I might still want snapping to work<br>
&lt;fremy> florian: if you have mandatory scroll snapping<br>
&lt;fremy> florian: none-of-which has scroll-snap-position<br>
&lt;fremy> florian: but the last one, has one<br>
&lt;fremy> florian: but is off-page<br>
&lt;fremy> florian: if the scroll-snapping is required to work, then you need the layout of all the children to know where to snap<br>
&lt;fremy> fantasai: but if you target it, you still do right?<br>
&lt;fremy> florian: yes?<br>
&lt;fremy> florian: I guess it maybe doesn't break if the elements inside don't have snap points inside<br>
&lt;fremy> TabAtkins: I think this is a particular case<br>
&lt;fremy> TabAtkins: but now that I think about it<br>
&lt;fremy> TabAtkins: but maybe that's not the most common case, maybe we can make an exception<br>
&lt;fremy> florian: then we need a test<br>
&lt;fremy> astearns: are you saying we should undo the previous resolution tab?<br>
&lt;fremy> TabAtkins: yes<br>
&lt;fremy> astearns: heycam felt it was weird anyway last time<br>
&lt;fremy> astearns: so, ok, let's resolve to revert that resolution?<br>
&lt;fremy> astearns: any objection?<br>
&lt;TabAtkins> Except for the case Florian brought up (of an off-screen element being the only snap point in a mandatory container), you only need to care about snaps when the element is on-screen (and you're doing layout anyway), so unless an implementor has a good reason why layout containment trapping snaps would be good for optimization, I think we should *not* trap snaps from layout containment.<br>
&lt;fremy> astearns: RESOLVED: revert the previous resolution about layout containment trapping snapping points<br>
&lt;fremy> ???: which resolution are we reverting?<br>
&lt;fremy> astearns: (restates_<br>
&lt;cbiesinger> s/???/cbiesinger/<br>
&lt;fremy> cbiesinger: ok<br>
&lt;fremy> florian: so we reverted and resolved in the opposite direction right?<br>
&lt;fremy> astearns: yes<br>
&lt;fremy> astearns: also, no engine did trap snap before<br>
&lt;fremy> astearns: so we revert back to what implementations do right now, if I understand<br>
</details>


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

Received on Wednesday, 6 May 2020 14:37:17 UTC