Skip to content

Add info about ::-webkit-details-marker in Safari#36583

Closed
wavebeem wants to merge 2 commits intomdn:mainfrom
wavebeem:patch-1
Closed

Add info about ::-webkit-details-marker in Safari#36583
wavebeem wants to merge 2 commits intomdn:mainfrom
wavebeem:patch-1

Conversation

@wavebeem
Copy link
Copy Markdown

Description

In Safari, list-style: none doesn't work to hide the <summary> marker. Instead you must use ::-webkit-details-marker to target the Shadow DOM and hide it with display: none.

Motivation

I needed to learn how to do this for my personal website, and it was hard to find a clear answer online. In particular, MDN seems to be the best resource for things like this, and it felt missing from this site.

Additional details

WebKit bug: https://bugs.webkit.org/show_bug.cgi?id=157323

Related issues and pull requests

There's a PR to change this behavior in Safari, but it will at least be useful to have this documentation for supporting historical versions of the browser.

WebKit GitHub: WebKit/WebKit#34778

In Safari, `list-style: none` doesn't work to hide the `<summary>` marker. Instead you must use `::-webkit-details-marker` to target the Shadow DOM and hide it with `display: none`.
@wavebeem wavebeem requested a review from a team as a code owner October 31, 2024 00:08
@wavebeem wavebeem requested review from estelle and removed request for a team October 31, 2024 00:08
@github-actions github-actions bot added Content:HTML Hypertext Markup Language docs size/xs [PR only] 0-5 LoC changed labels Oct 31, 2024
@github-actions
Copy link
Copy Markdown
Contributor

Preview URLs

@estelle
Copy link
Copy Markdown
Member

estelle commented Oct 31, 2024

The element that does/doesn't support list-style in this case is <summary>. The <summary> page does include browser compatibility data for list-style.

A likely issue is that the example, Customizing_the_disclosure_widget, should likely be on the <summary> page rather than the <details> page.

@wavebeem
Copy link
Copy Markdown
Author

Oh, haha, yeah thank you for the correction.

Would you support a change to have the <details> element page link to the <summary> element page for more information on how to customize it?

@estelle
Copy link
Copy Markdown
Member

estelle commented Oct 31, 2024

Would you support a change to have the <details> element page link to the <summary> element page for more information on how to customize it?

Yes.

If you want to take it on, I was actually thinking the best solution would be to move the last example on the <dialog> page to be the last example on the <summary> page (with a slightly different title, such as "styling the summary", and then adding a sentence at the end of the Customizing the appearance example to point to the now moved example, something to the effect of "See the <summary> page for an example of customizing the disclosure widget"

When creating a new example or changing the title of an example, the EmbedLiveSample macro needs to be updated:

{{EmbedLiveSample("Put new title here", 650, 120)}}

The marker can be removed with ::marker { content: "";} or ::marker { content: none;}, but that isn't supported in Safari either. See https://codepen.io/estelle/pen/QWerPEp. But that is information for the summary page, not the details page.

@wavebeem
Copy link
Copy Markdown
Author

wavebeem commented Nov 4, 2024

I'm not sure if I'll come back to this soon, but I appreciate your insight.

@wavebeem wavebeem closed this Nov 4, 2024
@wavebeem wavebeem deleted the patch-1 branch November 4, 2024 07:32
@estelle
Copy link
Copy Markdown
Member

estelle commented Nov 8, 2024

I added the example to <summary> in #36691

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Content:HTML Hypertext Markup Language docs size/xs [PR only] 0-5 LoC changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants