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

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