W3C home > Mailing lists > Public > whatwg@whatwg.org > November 2014

[whatwg] [hidden] attribute should not allow overrides via css

From: Bruno Racineux <bruno@hexanet.net>
Date: Wed, 05 Nov 2014 17:07:05 -0800
To: <whatwg@lists.whatwg.org>
Message-ID: <D0800786.90823%bruno@hexanet.net>
Those two lines from spec [1] are in conflict:

"Because this attribute is typically implemented using CSS, it's also
possible to override it using CSS"

"if something is marked hidden, it is hidden from all presentations"

The latter is not true as currently implemented.
The former allows a css enabled styled presentation to display a hidden
while browsing with *styles disabled* with have the element hidden (not
due to the default browser stylesheet making it so.

Technically it is therefore *not* hidden form all presentations and
breaks the hidden = aria-hidden accessibility assumptions. I find this

And allowing a css override, breaks my use case:

Say, I have a link: <a class="email" hidden>Email</a> . And I only want this
link to
render dynamically and conditionally as a mailto: href with a
'display:block' style.
I am unable to pre-style my links with a 'display:block', because it cancels
which makes 'hidden' useless to me here if it wasn't for a *[hidden] {
display: none; }
at the end of my stylesheet.

I strongly suggest that hidden be made a 'display: none !important' instead
to remedy this confusion.

[1] https://html.spec.whatwg.org/#the-hidden-attribute
Received on Thursday, 6 November 2014 01:07:34 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 17:00:26 UTC