Open dbaron opened 9 months ago
Based on the investigations we've done so far into styling of the <details>
and <summary>
elements, I can think of 6 separate technical pieces that are relevant to this issue (items 4 through 6 are relevant to animations of opening/closing the elements), in somewhat different states:
display
on both <details>
and <summary>
details
and summary
to be more styleablesummary { display: list-item }
may be motivated by people writing styles to the Gecko/Chromium modelsummary
is display: list-item
and the disclosure triangle is its marker.~summary
contents of a details
element
::details-content
, but I'm open to a different name.display: contents
, which means that using it for anything requires changing it to display: block
::details-content
pseudo-element.transition-behavior
property
@starting-style
and transition-behavior
focus area in Interop 2024@starting-style
rule
@starting-style
and transition-behavior
focus area in Interop 2024There was another piece that I had prototyped (closely related to item 3 above), but removed from the prototype because it turned out to not be useful. This was the ::details-summary
pseudo-element which styled the container for the <summary>
element. Similar to ::details-content
it was a little tricky to use because it defaulted to display: contents
, and it didn't seem to add any value, only confusion about when to use it and when not to. (It's just a wrapper for a single element, the first summary child. It's potentially useful in the case where there is no summary child, but I think that's mostly an error case anyway.)
The CSS Working Group just discussed improve styling of <details>/<summary> elements
, and agreed to the following:
RESOLVED: Expose the <details> contents slot as either a pseudo or a ::part, as decided in a joint meeting with WHATWG
RESOLVED: We desire to have no restrictions on the stylability of the display of <details> and <summary>
At this point the discussion in #9951 and the edits for #10083 have resolved on many of the issues that were blocking resolution here. The one point that I don't think we resolved on (unless I missed it) was the name of the pseudo-element. I'd like to resolve to use ::details-content
as the name for the pseudo-element for the part of the <details>
that opens and closes. I'm adding Agenda+
for that, although it's possible we could also do it as an asynchronous resolution given that it's already been discussed a bit.
The CSSWG will automatically accept this resolution one week from now if no objections are raised here. Anyone can add an emoji to this comment to express support. If you do not support this resolution, please add a new comment.
Proposed Resolution: Use ::details-content
as the name for the pseudo-element for the part of <details>
that opens and closes
No objection to the proposal. The previous resolution called for a joint meeting with WHATWG; for anyone like me who was looking for the outcome of that discussion, it's in the minutes here: https://github.com/whatwg/html/issues/10200#issuecomment-1998676547
RESOLUTION: We will use pseudo-elements for exposing styling of pieces of built-in controls. We would like these pseudo-elements to be as close to ::part() as possible (for example, in terms of what selectors work and how inheritance works) and intend to further explore the details of how to do this. (9 votes in favor, none opposed)
I don't quite understand why there are only a limited number of CSS properties that can be used in ::marker
, which severely restricts details from being a truly customizable styled component. The previous ::-webkit-details-marker
did not have these restrictions.
A very common use case is when arrows need to be animated using the rotate
property.
https://github.com/w3c/csswg-drafts/assets/2784308/add5858a-25b7-40cb-b2cb-9d3111920c58
Here is a collection of requests to support more properties in ::marker
.
Yeah, I agree that we should probably make marker styling more flexible. I haven't yet dug in to propose an exact set of changes...
RESOLVED: Use ::details-content
as the name for the pseudo-element for the part of <details>
that opens and closes
Is it problematic that it's display: contents
but details-content
? I guess there's already "content" usage elsewhere that will be similarly hard to remember.
Is it problematic that it's display: contents but details-content? I guess there's already "content" usage elsewhere that will be similarly hard to remember.
Imo, no.
I'd like to discuss improvements to the styling of the
<details>
and<summary>
elements.At our face-to-face meeting in July 2023, I presented some thoughts on improvements, and we had a discussion (see minutes).
I'm hoping to have some updates to present during our face-to-face in February, though they're not ready yet.