-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Need a way to styling the disclosure triangle of the <details> (or <summary>) element #722
Comments
I don't think the HTML spec is the right place to discuss this. HTML doesn't care much about how things should be rendered or styled. Those are in the scope of CSS, and thus it is better to discuss that in CSSWG. CSS Pseudo-Elements Module is likely the right place for this issue. |
@upsuper thanks. I'll close this and file it to the proper place. |
FWIW, this probably warrants a change of sorts to the HTML rendering section, since if we don't specify there how the default is rendered, it would be hard for it to be overridden. |
So if the CSS WG decies that |
FWIW, In CSS Counter Styles, cc @tabatkins, any thoughts about this topic? |
After discussion with @tabatkins and @fantasai, I think we should add the following presentational hint for summary {
display: list-item;
list-style: disclosure-closed;
}
details[open] > summary {
list-style: disclosure-open;
} and remove |
Hmm, that seems pretty weird to me, but I am happy to take the advice of our resident style experts if that's what implementers want to do. And it sounds like @aethanyc and @upsuper are up for implementing this in Gecko? So that's enough support for me to say this is good. I'd ideally like to track down someone in Blink and WebKit who'd be interested in implementing this, and make sure they're not opposed. But I'm OK with someone doing a PR for this change in the meantime. I will file a Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=590014 |
To clarify, I don't think we (Gecko) currently have plan to provide the unprefixed I agree with you that the concept "list item" and the corresponding properties are weird here, but @tabatkins and @fantasai think they are otherwise fine, and they are happy with it. From my point of view, it seems reusing these should also make implementing easier in Gecko. |
Also, overriding the triangle itself would directly be doable via changing |
To complement what @upsuper said, currently gecko don't implement summary as list-item to display the triangle. Instead I reuse the same code path which constructs the list-item in layout engine so that the web page can still see the triangle even if it sets summary as Of course, setting summary as a list-item does let you display and style the triangle as well. However at least in gecko we have to make the list style position summary {
display: list-item;
list-style: disclosure-closed inside;
}
details[open] > summary {
list-style: disclosure-open inside;
} |
Oh, I wasn't aware that the triangle is inside summary by default. Yeah, that makes sense. This isn't something Gecko-specific, but what the spec indicates. (BTW, I think we should support |
@aethanyc Given that the spec says that the details element should have Also, if you're going to use @upsuper Chrome puts the disclosure widget inside the summary element, but I don't see anything in the spec that says to do that. I guess the Mac screenshots [2] might imply it, but those are just examples. It also doesn't put any padding in the [1] https://html.spec.whatwg.org/multipage/rendering.html#the-details-element-2 |
@patrickdark Yes, the existing impls do not match the spec, and the elements have been used in wild, so we should just change the spec to match the impls. That says, we should remove the padding and make the marker |
@upsuper That seems like a strange position given that the Firefox implementation doesn't match the Chrome implementation. Chrome uses Aside from not matching the spec, the Chrome implementation needs to be changed anyway since it ignores OS conventions. Google seems to have implemented something similar to the OSX convention, which makes no sense on Windows. (You can see the Windows conventions by looking at the Device Manager.) Their widget behavior also needs a fix; clicking it twice selects the summary when that can be fixed with Lastly, Chrome is the only implementation. It seems like it would be better to fix these issues now than ship a poor clone of a poor implementation. |
Chrome is not the only implementation. Safari has that as well, although this exists before Blink forked. But you'll need to fix both now anyway. In addition, an important criteria is that, the elements have been used widely. Chrome platform status shows it has been used in ~0.08% of pages in web, which is enough a significant number. And Drupal said they have been using these elements in Drupal 8, which would potentially increase the number further in near future. Given these, changing the impl could break existing design, consequently cause web compatibility issue. Changing to Note that making spec match impls doesn't mean we need to make every details match, but instead, we want to make the spec sensible as far as we do not break the web without a good reason. |
This seems weird - why does current usage of a non-standard pseudo-element imply we should use ::before? It seems that, since ::before is currently usable on summary elements, naive compat concerns would imply we have to keep it free to use, so we should definitely be using some new pseudo. ::marker happens to work well with that. (We also purposely don't use ::before on anything currently, as it's intended to be kept for author usage.) In addition, everything @upsuper said is correct. |
What are the CSS properties that can/will be applied to the (new?) pseudo element? |
|
That's what I wanted to discuss:
|
This isn't in the scope of the HTML spec. Please discuss this in the www-style mailing list. |
@tabatkins I suggested using Regarding backward compatibility, I can't think of any situation where you would want both Add to that that you'll need a Now, authors will need to overwrite Furthermore, authors won't be able to use the main benefit of |
Markers can be styled pretty reasonably without ::marker (there's plenty of existing content styling list bullets). ::marker is limited in what it allows, but if you want more, you can just set it to 'block' and use ::before yourself.
All you need to do is set "display: block".
I'm not willing to assume that - ::before is used for lots more things than just "putting some text before the real content of the element".
Today, yes. Once ::marker is supported that won't be necessary.
We have not "rejected" ::marker in any significant manner.
Don't read too much into this - it's very common for implementors who aren't closely tied into the spec world to invent their own random crap.
I don't understand what you think the "main benefit... for backward compatibility" is. |
I hope that's the case, but the relevant Chromium bug¹, citing an incomplete spec and performance concerns regarding this feature, didn't leave me confident of that: "Until the spec is in a better state I don't see this moving forward." "Of note, the PseudoElement system was designed to be used for things that are rare." "In order to move forward with something like the above patch, we would need to justify the cost in terms of how many additional elements will we be creating?" Mozilla cited an incomplete spec 13 years ago², so what's changed? We still have a spec which says "None of its contents should be considered suitable for implementation at this point."³ Now the design of the ¹ https://bugs.chromium.org/p/chromium/issues/detail?id=457718
I don't understand what exactly you're trying to ask with your elided quotation. The essence of what I trying to say in the paragraph is that there's no near-term benefit to using list counters for the disclosure widget. The rationale for using list counters to implement greater styling capability hinges entirely on the unicorn feature called To understand where I'm coming from, imagine you're an author that wants to use |
CSS Pseudo-Elements spec has a restricted (thus more feasible)
You don't need to. You can use |
I didn't mean people should use these two pseudos. I mean, they can be considered as the prefixed version of |
Wow, I didn't realize there were two contradictory specs defining this feature. The feature set in the reduced version is terrible. You can't even use the The lack of customization options means that On the bright side, maybe we'll get an unprefixed
These pseudo-elements are far less powerful than the Chrome's pseudo-element also has some quirks because it refers to a scalable image. For example, changing the width of the bullet region to a specified width without resizing the bullet itself is non-trivial.
Try The workaround requires editing the markup by, say, nesting a |
Chrome is looking for input from other vendors on making this change; see https://bugs.chromium.org/p/chromium/issues/detail?id=590014#c17. In particular:
@upsuper your expertise would especially be appreciated. |
I believe |
This question was raised in bug 1221416 when implementing
<details>
and<summary>
elements in Firefox.The spec does not specify how to customize of the triangle or should it be customizable, but we should support it somehow. The spec might need to clarify on this.
Currently, webkit supports a non-standard pseudo-class
summary::-webkit-details-marker
as this article said.@upsuper proposed we could add
::marker
support for<summary>
element in pseudo-element spec. This makes sense to me.Any other ideas? @bzbarsky
The text was updated successfully, but these errors were encountered: