Skip to content

Commit 5e0b8e6

Browse files
authored
Add activation behavior for <summary>
Fixes #2246. This also fixes the value that the open attribute is set to to be the empty string, instead of "open", matching existing implementations. Tests at web-platform-tests/wpt#4539 show that both implementers of <details> follow these same semantics, despite there having been no spec previously. The only exception is that Blink included a being-rendered check, but that was removed; see https://bugs.chromium.org/p/chromium/issues/detail?id=681711. There's still some discussion ongoing as to whether we should change the content models to disallow interactive descendants of <summary> elements, happening in #2272.
1 parent 7f4bc78 commit 5e0b8e6

File tree

1 file changed

+41
-4
lines changed

1 file changed

+41
-4
lines changed

source

Lines changed: 41 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55325,10 +55325,17 @@ interface <dfn>HTMLDetailsElement</dfn> : <span>HTMLElement</span> {
5532555325
information should be shown.</p>
5532655326

5532755327
<p>The user agent should allow the user to request that the additional information be shown or
55328-
hidden. To honor a request for the details to be shown, the user agent must set the <code
55329-
data-x="attr-details-open">open</code> attribute on the element to the value <code
55330-
data-x="">open</code>. To honor a request for the information to be hidden, the user agent must
55331-
remove the <code data-x="attr-details-open">open</code> attribute from the element.</p>
55328+
hidden. To honor a request for the details to be shown, the user agent must <span
55329+
data-x="concept-element-attributes-set-value">set</span> the <code
55330+
data-x="attr-details-open">open</code> attribute on the element to the empty string. To honor a
55331+
request for the information to be hidden, the user agent must <span
55332+
data-x="concept-element-attributes-remove">remove</span> the <code
55333+
data-x="attr-details-open">open</code> attribute from the element.</p>
55334+
55335+
<p class="note">This ability to request that additional information be shown or hidden may simply
55336+
be the <span>activation behavior</span> of the appropriate <code>summary</code> element, in the
55337+
case such an element exists. However, if no such element exists, user agents should still provide
55338+
this ability through some other user interface affordance.</p>
5533255339

5533355340
<p>Whenever the <code data-x="attr-details-open">open</code> attribute is added to or removed from
5533455341
a <code>details</code> element, the user agent must <span>queue a task</span> that runs the
@@ -55446,6 +55453,33 @@ interface <dfn>HTMLDetailsElement</dfn> : <span>HTMLElement</span> {
5544655453
rest of the contents of the <code>summary</code> element's parent <code>details</code>
5544755454
element<span w-nodev>, if any</span>.</p>
5544855455

55456+
<div w-nodev>
55457+
55458+
<p>The <span>activation behavior</span> of <code>summary</code> elements is to run the following
55459+
steps:</p>
55460+
55461+
<ol>
55462+
<li><p>If this <code>summary</code> element has no parent node, then abort these steps.</p></li>
55463+
55464+
<li><p>Let <var>parent</var> be this <code>summary</code> element's parent node.</p>
55465+
55466+
<li><p>If <var>parent</var> is not a <code>details</code> element, then abort these steps.</p>
55467+
55468+
<li><p>If <var>parent</var>'s first child <code>summary</code> element is not this
55469+
<code>summary</code> element, then abort these steps.</p></li>
55470+
55471+
<li>
55472+
<p>If the <code data-x="attr-details-open">open</code> attribute is present on
55473+
<var>parent</var>, then <span data-x="concept-element-attributes-remove">remove</span> it.
55474+
Otherwise, <span data-x="concept-element-attributes-set-value">set</span> <var>parent</var>'s
55475+
<code data-x="attr-details-open">open</code> attribute to the empty string.</p>
55476+
55477+
<p class="note">This will then run the <span>details notification task steps</span>.</p>
55478+
</li>
55479+
</ol>
55480+
55481+
</div>
55482+
5544955483

5545055484

5545155485
<h4 id="the-menu-element">The <dfn id="menus"><code>menu</code></dfn> element</h4>
@@ -72262,6 +72296,9 @@ END:VCARD</pre>
7226272296

7226372297
<li><code>menuitem</code> elements</li>
7226472298

72299+
<li><code>summary</code> elements that are the first child <code>summary</code> element of a
72300+
<code>details</code> element</li>
72301+
7226572302
<li>Elements with a <code data-x="attr-draggable">draggable</code> attribute set, if that would
7226672303
enable the user agent to allow the user to begin a drag operations for those elements without
7226772304
the use of a pointing device</li>

0 commit comments

Comments
 (0)