Skip to content

Commit

Permalink
[css-contain-2] Define how animations and transitions act on skipped …
Browse files Browse the repository at this point in the history
…elements. #5611
  • Loading branch information
tabatkins committed Apr 2, 2021
1 parent 1ced684 commit 82fc7dd
Showing 1 changed file with 56 additions and 0 deletions.
56 changes: 56 additions & 0 deletions css-contain-2/Overview.bs
Expand Up @@ -1542,6 +1542,62 @@ Restrictions and Clarifications {#cv-notes}

8. [=Skipped contents=] do not contribute to the result of {{HTMLElement/innerText}}.

9. While an element is [=skipped=],
CSS transitions and animations on the element do not update:

* New animations are not created even if newly-applied style would start one.
* Existing animations do not advance in their timeline.
* Running animations on the element do not end.

If script queries the style of a [=skipped=] element
(causing a [=style change event=])
such that knowing the state of animations is required
to return correct information,
animations are "refreshed" at that moment
according to the styles at the time of that [=style change event=]:
new animations are created if necessary;
existing animations are advanced
to the point on their timeline they would have been at
were they never skipped at all;
animations that have would have ended since the last "refresh"
are ended.

If a transition or animation-related event would have been triggered
as a result of changes occurring during the "refresh" interval,
they are fired when the animations are "refreshed",
in the same order they would have originally fired in
had the element never been [=skipped=].
If multiple iterations of an animation would have completed during this period,
only one {{animationiteration}} event must be triggered,
ordered as if it were triggered at the first completed iteration during the refresh interval.

When an element stops being [=skipped=],
animations are refreshed
and then resume advancing on their timelines as normal from that point.

Note: Overall, this is similar to the behavior of transitions/animations
when a background tab is brought back to the foreground,
allowing user agents to skip as much unnecessary animation work as possible
without overly disrupting the animations when they become relevant again.

10. While an element is [=skipped=],
it must not start any transitions,
even if a [=style change event=] affects its computed styles.

When an element stops being [=skipped=],
it must not start any transitions
as a result of the [=style change event=]
associated with it no longer being [=skipped=].

Note: This is similar to an element switching from ''display:none''
to a non-''display/none'' value--
even tho the styles are <em>technically</em> changing in that case
(from their initial values
to their "proper" values from the cascade),
no transitions are started.



Accessibility Implications {#cv-a11y}
-------------------------------------

Expand Down

0 comments on commit 82fc7dd

Please sign in to comment.