You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Ability to style default summary in <details> #8770
addition/proposalNew features or enhancementstopic: renderingHow elements are expected to render: the user agent style sheettopic: selectorsPseudo-classes HTML defines, such as :checked, :open and :popover-open
Just out of curiosity, why limit that to the 'default summary' instead of making it apply to the 'active summary' (ie, whatever the part internally playing the summary role is). I don't have a good name for that, so I'll just use ::summary-part to illustrate what I mean..
I guess I was suggesting that maybe it isn't the <summary> you want to style after all but kind of the (inspecting the chrome shadow dom anyway) details-summary slot, and we'd expose... basically that (handwavingly)
That seems like it could create misalignments with how the details summary could expose the content as in the collapsed state, but it would actually be shown. And vice versa.
Likely could be done, but just needs to be on the checklist of things to do if allowing that
@jakearchibald true, but there is no native HTML element that triggers a dialog that would expose an expanded/collapsed state. So not a 1:1 comparison with details/summary where if you make the contents of the details visible by CSS then the state communicated when someone interacts with the summary element would also need to change based on this modification.
Given that all major engines (Chromium, Gecko, WebKit) implement details in terms of shadow DOM, it's also possible we could do this by moving towards (a) standardizing that shadow DOM (or the necessary aspects of it) and (b) exposing parts that could be styled using ::part() (as selectmenu does).
(Also see an explainer I'm working on about improving stylability of details.)
I'm not sure there's agreement that. In particular I find it rather inconsistent with existing elements to use userland shadow tree APIs. The internal shadow tree is defined already (in the Rendering section) and defining built-in pseudo-elements for it as suggested upthread seems reasonable.
Reacted by Domenic Denicola, Simon Pieters and Raura
addition/proposalNew features or enhancementstopic: renderingHow elements are expected to render: the user agent style sheettopic: selectorsPseudo-classes HTML defines, such as :checked, :open and :popover-open
Activity
bkardell commentedon Feb 9, 2023
Just out of curiosity, why limit that to the 'default summary' instead of making it apply to the 'active summary' (ie, whatever the part internally playing the summary role is). I don't have a good name for that, so I'll just use
::summary-partto illustrate what I mean..The UA sheet would just be:
And so would most actual stylesheets, I expect.
If that makes any sense, it needs a better name.
jakearchibald commentedon Feb 9, 2023
I couldn't think of any other case where a pseudo-element selector selected something that wasn't a pseudo-element, or shadow DOM.
bkardell commentedon Feb 9, 2023
I guess I was suggesting that maybe it isn't the
<summary>you want to style after all but kind of the (inspecting the chrome shadow dom anyway)details-summaryslot, and we'd expose... basically that (handwavingly)jakearchibald commentedon Feb 10, 2023
Yeah, that could work. I see the appeal of having a single selector for it. Not sure what to name it, but I'm sure there's a name out there.
zcorpan commentedon Feb 13, 2023
This seems reasonable to me. You should probably file an issue for the CSS WG as well. cc @whatwg/css
jakearchibald commentedon Feb 13, 2023
We may as well, at the same time, expose the details content. It'd be nice to allow CSS to override the open/close state.
scottaohara commentedon Feb 13, 2023
That seems like it could create misalignments with how the details summary could expose the content as in the collapsed state, but it would actually be shown. And vice versa.
Likely could be done, but just needs to be on the checklist of things to do if allowing that
nt1m commentedon Feb 13, 2023
#8884
jakearchibald commentedon Feb 14, 2023
@scottaohara fwiw,
<dialog>already has these misalignments. You can display a closed dialog.scottaohara commentedon Feb 14, 2023
@jakearchibald true, but there is no native HTML element that triggers a dialog that would expose an expanded/collapsed state. So not a 1:1 comparison with details/summary where if you make the contents of the details visible by CSS then the state communicated when someone interacts with the summary element would also need to change based on this modification.
dbaron commentedon May 4, 2023
Given that all major engines (Chromium, Gecko, WebKit) implement
detailsin terms of shadow DOM, it's also possible we could do this by moving towards (a) standardizing that shadow DOM (or the necessary aspects of it) and (b) exposing parts that could be styled using::part()(asselectmenudoes).(Also see an explainer I'm working on about improving stylability of
details.)annevk commentedon May 5, 2023
I'm not sure there's agreement that. In particular I find it rather inconsistent with existing elements to use userland shadow tree APIs. The internal shadow tree is defined already (in the Rendering section) and defining built-in pseudo-elements for it as suggested upthread seems reasonable.