Re: [csswg-drafts] [css-scroll-anchoring-1] add API to expose current scroll anchor and offset (#6225)

> Upon investigating the idea further, I noticed a similar idea is mentioned in the scroll anchoring explainer doc (https://github.com/WICG/ScrollAnchoring/blob/master/explainer.md#history-scroll-restoration).

Interesting. That section of the explainer for scroll anchoring is considering the case of a history navigation and the need to restore scroll to show the previously-anchored element.

@noahlemen: do you think it would be reasonable to model your restorations as SPA navigations in the browser history? You'd also only gett scroll offsets for the root scroller, is that enough? Then maybe this use case could be solved with a new History API option saying that, when pushing a new state, the current scroll anchor should be associated with that entry, rather than an absolute scroll offset.

If using the root scroller is too restrictive, maybe we should also expose nested scroller state to the History API?

But first let's see if the History API is enough; otherwise we might need to expose a JavaScript API for obtaining the current scroll anchor and its offset.


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


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

Received on Friday, 30 April 2021 23:11:03 UTC