whatwg / html

HTML Standard
https://html.spec.whatwg.org/multipage/
Other
8.1k stars 2.67k forks source link

Permit overriding user agent styles for summary details when closed #8551

Open brennanyoung opened 1 year ago

brennanyoung commented 1 year ago

Dismayed to discover that there is no way to override default user agent styles for summary details when closed.

I have no problem with default user agent styles, in fact I approve of the nice list-item with disclosure triangle.

The problem comes if you want to render the "closed" state in any other way than the default - which is display:none; - a setting which prohibits any other kind of presentation (for example a "blacked out/redacted" text appearance for spoiler content - a very common idiom, or some kind of "blur" overlay for NSFW or adults-only content).

This means that there is a Babel of implementations for "spoiler" and "NSFW" content in the wild, most of which have no default keyboard accessibility, relying on "content-on-hover", and other WCAG-violating hacks.

Details/summary has the perfect semantics, and is well-supported by assistive technology, but the default styles are too inflexible. The implementation on all browsers is tucked away inside a closed shadow DOM. (Why?)

Is there any way this could be exposed so that custom css might offer alternative presentations?

Bonus points, if this would permit animation between closed and open states.

jimmyfrasche commented 1 year ago

For reference: https://discourse.wicg.io/t/standardized-spoiler-tag/5814