Skip to content

Commit 763d618

Browse files
authored
Merge pull request w3c#7515 from vmpstr/contentvisibilityevent
[css-contain-2] Add ContentVisibilityAutoStateChanged event (closes w3c#7384)
2 parents fc6766d + 84e3e78 commit 763d618

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

css-contain-2/Overview.bs

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1552,6 +1552,52 @@ Using ''content-visibility: auto''</h3>
15521552
will be forced to rely on the ''200px'' height estimate.
15531553
</div>
15541554

1555+
Detecting ''content-visibility: auto'' state changes: the 'ContentVisibilityAutoStateChanged' event {#content-visibility-auto-state-changed}
1556+
--------------------------------------------------------------------------------------------------------------------------------------------
1557+
1558+
<pre class='idl'>
1559+
[Exposed=Window]
1560+
interface ContentVisibilityAutoStateChangedEvent : Event {
1561+
constructor(DOMString type, optional ContentVisibilityAutoStateChangedEventInit eventInitDict = {});
1562+
readonly attribute boolean skipped;
1563+
};
1564+
dictionary ContentVisibilityAutoStateChangedEventInit : EventInit {
1565+
boolean skipped = false;
1566+
};
1567+
</pre>
1568+
1569+
<div class="attributes">
1570+
1571+
Description of ContentVisibilityAutoStateChangedEvent attributes:
1572+
1573+
: <dfn attribute for=ContentVisibilityAutoStateChangedEvent>skipped</dfn>
1574+
:: Set to true if target changed state to [=skip its contents=], and false otherwise.
1575+
1576+
</div>
1577+
1578+
<div class="members">
1579+
1580+
Description of ContentVisibilityAutoStateChangedEventInit members:
1581+
1582+
: <dfn dict-member for=ContentVisibilityAutoStateChangedEventInit>skipped</dfn>
1583+
:: See the description of the {{ContentVisibilityAutoStateChangedEvent/skipped}} attribute.
1584+
1585+
</div>
1586+
1587+
This event is fired on an element with ''content-visibility: auto'' style when
1588+
the rendering state changes and the element either becomes or stops being
1589+
[=relevant to the user=].
1590+
1591+
This event is dispatched by posting a task at the time when the state change occurs.
1592+
1593+
Note that elements in ''content-visibility: auto'' subtrees remain semantically
1594+
relevant even for elements that [=skip its contents=]. This means that it is
1595+
inappropriate to use this signal to indefinitely skip DOM updates in the
1596+
subtree that is skipped. Instead, it should be used to deprioritize updates,
1597+
but ensure that the content remains semantically relevant and reasonably
1598+
up-to-date. This is particularly important for assistive technologies which
1599+
consume this content even when the ancestor is set to [=skip its contents=].
1600+
15551601
Restrictions and Clarifications {#cv-notes}
15561602
-------------------------------------------
15571603

0 commit comments

Comments
 (0)