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
base: main
Are you sure you want to change the base?
Conversation
This makes a number of related changes to specify the rendering of the <details> element: * It specifies the structure of the user agent shadow tree. This appears largely interoperable between implementations with the exception of the style or link element for the default summary styles: Gecko uses a link element as the first child, Chromium uses a style element as the last child, and WebKit does not use a style element (see below). This specifies a style or link as the first child. * It specifies the existence of the default summary and the presence of UA dependent text inside of it. This is present in all of Chromium, Gecko, and WebKit. * It specifies the styles needed for the default summary. These match Chromium and Gecko. (These are not present in WebKit because WebKit's mechanism for styling the marker does not match the existing spec.) * It removes the restriction that <details> is a block and cannot be changed. This is prototyped in Chromium and Gecko. This fixes whatwg#9830. * It specifies that the summary element is display: block by default. This matches all of Chromium, Gecko, and WebKit. * It specifies which element matches the ::details-content pseudo-element. (TODO: This needs to be specified in CSS) This is prototyped in Chromium. See w3c/csswg-drafts#9879 and w3c/csswg-drafts#9951 for more background.
Sorry, apparently Shift-enter submits the form, I wasn't quite ready to submit and I'll continue editing the above comment. |
Are these differences observable? If not, then perhaps the spec can be clearer about that, so that people understand any implementation strategy that achieves equivalent results is fine. |
That's a good question. When I wrote it I was (for some reason) thinking that the ordering was observable via selectors, but now that I think about it again I think it's not. We do need to get the exact CSS definitions of what does and doesn't apply sorted out, though, to make sure. But I think as long as (a) |
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.
Can we describe it as two child elements and an associated style sheet? It seems like it should be immaterial how the style sheet is associated with the shadow tree. It just needs to have one.
<p>The second 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> |
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.
source
Outdated
<!-- TODO: link to CSS definition when spec is ready --> | ||
<p>This element is expected to match the '::details-content' pseudo-element.</p> |
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 this also be mentioned in HTML's Selectors section?
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'm not sure. The one existing pseudo-element (::file-selector-button
) is not currently mentioned there. It seems like it might be useful to mention the pseudo-elements in that section, but it also seems like maybe (unlike for the pseudo-classes) if we do so, perhaps the pseudo-elements part of that section should be more like an index than the location of the formal definition?
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.
Yeah, I guess that's correct. In which case maybe it's not worth it.
…o be the first child.
I've revised the change to go mostly in this direction: I still describe the style as an element, explicitly note that the order isn't observable, and note that its association using an element isn't observable either (although I don't know what other standard mechanism we'd describe the styles with). I also now describe it as the third child rather than the first, since in hindsight it seems nice to use "first" and "second" for the first and second rendered children. But I didn't go so far as to just handwave about how the association is made. Does that seem reasonable? |
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.
Editorially LGTM. Happy to merge when we have the checkboxes filled out. Let us know if you have other people (e.g. @emilio) whose reviews you want to block on before merging.
Adopted stylesheets would be an option fwiw.
Works for me. |
<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 comment
The reason will be displayed to describe this comment to others. Learn more.
You can probably use :host > summary
for parallelism with the rule below right? (or just summary
?)
This makes a number of related changes to specify the rendering of the
<details>
element:<details>
is a block and cannot be changed. This is prototyped in Chromium and Gecko. This fixes Don't force <details> to be a block. #9830.See w3c/csswg-drafts#9879 and w3c/csswg-drafts#9951 for more background.
(See WHATWG Working Mode: Changes for more details.)
/rendering.html ( diff )