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
element,
while browsing with *styles disabled* with have the element hidden (not
displayed)
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
conflicting.

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
'hidden',
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.3.1 : Monday, 13 April 2015 23:09:32 UTC