-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Specify the rendering of <details> in more detail. #10265
Open
dbaron
wants to merge
3
commits into
whatwg:main
Choose a base branch
from
dbaron:details-styling
base: main
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+60
−23
Open
Changes from 2 commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -134169,6 +134169,9 @@ input[type=image i][align=bottom i], object[align=bottom i] { | |
|
||
<pre><code class="css">@namespace "http://www.w3.org/1999/xhtml"; | ||
|
||
details, summary { | ||
display: block; | ||
} | ||
details > summary:first-of-type { | ||
display: list-item; | ||
counter-increment: list-item 0; | ||
|
@@ -134178,28 +134181,62 @@ details[open] > summary:first-of-type { | |
list-style-type: disclosure-open; | ||
}</code></pre> | ||
|
||
<p>The <code>details</code> element is expected to render as a <span>block box</span>. The element | ||
is also expected to have an internal <span>shadow tree</span> with two <span | ||
data-x="concept-slot">slots</span>. The first <span data-x="concept-slot">slot</span> is expected | ||
to take the <code>details</code> element's first <code>summary</code> element child, if any. The | ||
second <span data-x="concept-slot">slot</span> is expected to take the <code>details</code> | ||
element's remaining descendants, if any.</p> | ||
|
||
<p>The <code>details</code> element's first <code>summary</code> element child, if any, is | ||
expected to allow the user to request the details be shown or hidden.</p> | ||
|
||
<p>The <code>details</code> element's second <span data-x="concept-slot">slot</span> is expected | ||
to have its <code data-x="attr-style">style</code> attribute set to "<code data-x="">display: | ||
block; content-visibility: hidden;</code>" when the <code>details</code> element does not have an | ||
<code data-x="attr-details-open">open</code> attribute. When it does have the <code | ||
data-x="attr-details-open">open</code> attribute, the <code data-x="attr-style">style</code> | ||
attribute is expected to be removed from the second <span data-x="concept-slot">slot</span>.</p> | ||
|
||
<p class="note">Because the slots are hidden inside a shadow tree, this <code | ||
data-x="attr-style">style</code> attribute is not directly visible to author code. Its impacts, | ||
however, are visible. Notably, the choice of <code data-x="">content-visibility: hidden</code> | ||
instead of, e.g., <code data-x="">display: none</code>, impacts the results of various APIs that | ||
query layout information.</p> | ||
<p>The <code>details</code> element is expected to have an internal <span>shadow tree</span> with | ||
three child elements:</p> | ||
|
||
<ol> | ||
<li> | ||
<p>The first child element is a <code>slot</code> that is expected to take the | ||
<code>details</code> element's first <code>summary</code> element child, if any. This element | ||
has a single child <code>summary</code> element called the <dfn>default summary</dfn> which has | ||
text content that is <span>implementation-defined</span> (and probably locale-specific).</p> | ||
|
||
<p>The <code>summary</code> element that this slot <span>represents</span> is expected to allow | ||
the user to request the details be shown or hidden.</p> | ||
</li> | ||
|
||
<li> | ||
<p>The second child element is a <code>slot</code> that is expected to take the | ||
<code>details</code> element's remaining descendants, if any. This element has no contents.</p> | ||
|
||
<!-- TODO: link to CSS definition when spec is ready --> | ||
<p>This element is expected to match the '::details-content' pseudo-element.</p> | ||
|
||
<p>This element is expected to have its <code data-x="attr-style">style</code> attribute set to | ||
"<code data-x="">display: block; content-visibility: hidden;</code>" when the | ||
<code>details</code> element does not have an <code data-x="attr-details-open">open</code> | ||
attribute. When it does have the <code data-x="attr-details-open">open</code> attribute, the | ||
<code data-x="attr-style">style</code> attribute is expected to be removed.</p> | ||
|
||
<p class="note">Because the slots are hidden inside a shadow tree, this <code | ||
data-x="attr-style">style</code> attribute is not directly visible to author code. Its impacts, | ||
however, are visible. Notably, the choice of <code data-x="">content-visibility: hidden</code> | ||
instead of, e.g., <code data-x="">display: none</code>, impacts the results of various APIs that | ||
query layout information.</p> | ||
</li> | ||
|
||
<li> | ||
<p>The third child element is either a <code>link</code> or <code>style</code> | ||
element with the following styles for the <span>default summary</span>:</p> | ||
<pre><code class="css">:host summary { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can probably use |
||
display: list-item; | ||
counter-increment: list-item 0; | ||
list-style: disclosure-closed inside; | ||
} | ||
:host([open]) > summary { | ||
list-style-type: disclosure-open; | ||
}</code></pre> | ||
<p class="note">The position of this child element relative to the other two is not observable. | ||
This means that implementations might have it in a different order relative to its siblings. | ||
Implementations might even associate the style with the shadow tree using a mechanism that is | ||
not an element.</p> | ||
</li> | ||
|
||
</ol> | ||
|
||
<p class="note">The structure of this shadow tree is observable through the ways that the children | ||
of the <code>details</code> element and the '::details-content' pseudo-element respond to CSS | ||
styles.</p> | ||
|
||
<!-- https://mail.gnome.org/archives/usability/2006-June/msg00015.html --> | ||
|
||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we recommend here that it follows from the node's language? I think that's what we do for form controls today even though it's not (yet) implemented?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This matches the current wording for the default text of submit/reset buttons and (except for "possibly" versus "probably") the text of the "Choose file" button in
<input type=file>
. The only wording I found that seems like what you're thinking of was the wording about presentation of dates, times, and numbers. This seems more similar to submit/reset and to the file chooser button than it it does to presentation of dates, in that it feels a bit odd to make this differ from those.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suspect that when we changed the wording for dates, times, and numbers, the button language was overlooked. But I guess we can sort that out in a follow-up.