Re: [csswg-drafts] [css-contain-2] content-visibility should pause css animations in subtree (#5611)

Does this include css transitions? I think for consistency it perhaps should, although transitions normally don't have the ability to be paused. Does this include web animations? I think it shouldn't since the web animation's lifetime is not tied to the element[1].

This does add a bit of hysteresis about whether content-visibility elements have been visible in the past. I.e. new content will not be styled so the animations won't be created until the content is first visible, and animations will start whenever any style invalidation is requested.

Pausing may make the most sense, but I think it's worth considering all of the options:

1. Pause CSS animations. This would be a fairly new behavior, would only apply to elements which had previously been visible (since only those know they have css animations), and is inconsistent with how animations normally continue on otherwise invisible elements (e.g. `visibility: hidden`, `opacity: 0` etc) or how animations are removed on `display: none` elements.
2. Continue to tick animations. This would be consistent with `visibility: hidden` and with how web animations would continue to tick even when the contents of the subtree are skipped. Also with `content-visibility: auto` I believe this option makes the most sense as normally scrolling elements off screen does not pause running animations.
3. Remove animations. This would be consistent with `display: none`, which would likely be what a polyfill of content-visibility would do since it is conceptually closest. It also is consistent with how content which has not yet been visible does not have animations until it becomes visible.

[1] https://jsbin.com/fobafok/edit?html,css,js,output

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


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

Received on Tuesday, 13 October 2020 14:11:45 UTC