Re: [csswg-drafts] [scroll-animations-1]: How to handle invalid source for a view-timeline. (#7259)

I think there's possibly two decisions to be made here:

1. Should you be able to set the source on a ViewTimeline? We could assume that the source is the nearest ancestor [scroll container](https://www.w3.org/TR/css-overflow-3/#scroll-container) of the subject. If we do this, there would be no way to construct an invalid ViewTimeline, however it may limit some use cases.

   It's common for developers to use overflow: hidden to clip the painting of elements, which [is considered a scroll container](https://www.w3.org/TR/css-overflow-3/#valdef-overflow-hidden). This may be a common enough case that we want to provide a way to work around it and point to an ancestor of that element.

   On the flip-side, if you specify a node that is not the immediate scroll ancestor, the animation behavior could be pretty erratic, as scrolling either scroller up or down would progress the animation forwards / backwards.

2. If you can set the source on a ViewTimeline, then what do we do when you set a source which is not an ancestor? This could happen both during the initial creation, but also later on as a result of DOM modifications. Since it can go in and out of this valid state I would suggest that perhaps the timeline should become inactive (produce no animation time value) when the timeline is in an inactive state. This is the same as what we do for a ScrollTimeline on a scroller which is not currently scrollable.

My proposal would be that we do not allow the developer to specify the source on a ViewTimeline, and instead observe the element's position within its nearest ancestor scroll container. I think we could add support for this later, but the behavior of observing the position in a scroller which is not the immediate scroll container adds non-trivial complexity (have to handle changes in all intermediate scrollers) and is likely to produce erratic animations.

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


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

Received on Wednesday, 25 May 2022 19:50:40 UTC