Skip to content

Commit 82fc7dd

Browse files
committed
[css-contain-2] Define how animations and transitions act on skipped elements. #5611
1 parent 1ced684 commit 82fc7dd

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed

css-contain-2/Overview.bs

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1542,6 +1542,62 @@ Restrictions and Clarifications {#cv-notes}
15421542

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

1545+
9. While an element is [=skipped=],
1546+
CSS transitions and animations on the element do not update:
1547+
1548+
* New animations are not created even if newly-applied style would start one.
1549+
* Existing animations do not advance in their timeline.
1550+
* Running animations on the element do not end.
1551+
1552+
If script queries the style of a [=skipped=] element
1553+
(causing a [=style change event=])
1554+
such that knowing the state of animations is required
1555+
to return correct information,
1556+
animations are "refreshed" at that moment
1557+
according to the styles at the time of that [=style change event=]:
1558+
new animations are created if necessary;
1559+
existing animations are advanced
1560+
to the point on their timeline they would have been at
1561+
were they never skipped at all;
1562+
animations that have would have ended since the last "refresh"
1563+
are ended.
1564+
1565+
If a transition or animation-related event would have been triggered
1566+
as a result of changes occurring during the "refresh" interval,
1567+
they are fired when the animations are "refreshed",
1568+
in the same order they would have originally fired in
1569+
had the element never been [=skipped=].
1570+
If multiple iterations of an animation would have completed during this period,
1571+
only one {{animationiteration}} event must be triggered,
1572+
ordered as if it were triggered at the first completed iteration during the refresh interval.
1573+
1574+
When an element stops being [=skipped=],
1575+
animations are refreshed
1576+
and then resume advancing on their timelines as normal from that point.
1577+
1578+
Note: Overall, this is similar to the behavior of transitions/animations
1579+
when a background tab is brought back to the foreground,
1580+
allowing user agents to skip as much unnecessary animation work as possible
1581+
without overly disrupting the animations when they become relevant again.
1582+
1583+
10. While an element is [=skipped=],
1584+
it must not start any transitions,
1585+
even if a [=style change event=] affects its computed styles.
1586+
1587+
When an element stops being [=skipped=],
1588+
it must not start any transitions
1589+
as a result of the [=style change event=]
1590+
associated with it no longer being [=skipped=].
1591+
1592+
Note: This is similar to an element switching from ''display:none''
1593+
to a non-''display/none'' value--
1594+
even tho the styles are <em>technically</em> changing in that case
1595+
(from their initial values
1596+
to their "proper" values from the cascade),
1597+
no transitions are started.
1598+
1599+
1600+
15451601
Accessibility Implications {#cv-a11y}
15461602
-------------------------------------
15471603

0 commit comments

Comments
 (0)