W3C home > Mailing lists > Public > public-css-archive@w3.org > January 2021

Re: [csswg-drafts] [css-contain-2] Allow scroll position to be restored when element becomes un-skipped with content-visibility (#5869)

From: Robert Flack via GitHub <sysbot+gh@w3.org>
Date: Wed, 13 Jan 2021 23:46:52 +0000
To: public-css-archive@w3.org
Message-ID: <issue_comment.created-759829793-1610581611-sysbot+gh@w3.org>
> > It seems as though you should be able to query the offset (e.g. scrollTop and scrollLeft) and size (scrollHeight and scrollWidth) forcing a layout if these are no longer fresh. This is similar to querying the bounds of an element within the display locked tree.
> 
> I think if we resolve the other issue to not add overflow here, then these can just return 0 (or whatever is the appropriate default without forcing the layout), right?

They can, it's just very special cased behavior. For most display locked content it is as if we simply skipped the rendering, but it still returns the correct values if queried, so to extend that to the scrollable content it would make more sense if these values were considered part of the "hidden" subtree - i.e. updated if queried but otherwise not visible from the outside effectively moving the scrolling content inside the "contained" subtree.

> > When contents change I think we should be as consistent as possible with the behavior where the tree is not locked. I.e. with scroll anchoring we would attempt to anchor to the element at the top of the scroller. I think the same should happen here, where we anchor to the last element that was at the top of the scroller when it was locked.
> 
> I think this may be overkill. I agree conceptually that it would be the best thing to do, but the scroll anchoring algorithm is pretty complicated and if we also have to do it on items that are actually not visible (under content-visibility), and not even rendered, I suspect that we would defeat a lot of the optimizations that we can have. WDYT?

We wouldn't run anchoring while the contents were hidden, but rather save the anchor node before hiding, and then restore it after the content is no longer hidden, effectively treating the entire duration while the scrollable content was hidden as if it was a single layout update.

-- 
GitHub Notification of comment by flackr
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/5869#issuecomment-759829793 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Wednesday, 13 January 2021 23:46:54 UTC

This archive was generated by hypermail 2.4.0 : Tuesday, 5 July 2022 06:42:25 UTC