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

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

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Wed, 5 Nov 2014 17:13:30 -0800
Message-ID: <CAAWBYDAUL6XQ=8kLrS2wVbnC0GwGvYD7dbVqE512YbnnWKYwWg@mail.gmail.com>
To: Bruno Racineux <bruno@hexanet.net>
Cc: WHATWG <whatwg@lists.whatwg.org>
On Wed, Nov 5, 2014 at 5:07 PM, Bruno Racineux <bruno@hexanet.net> wrote:
> 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

This is intentionally *not* done, so that authors can hide it using
whichever technique they wish; in particular, authors need to be able
to do a transition of styles when setting/removing 'hidden', like
fading it to/from opacity:0.  Forcing it to display:none would prevent
these kinds of animations.

~TJ
Received on Thursday, 6 November 2014 01:14:14 UTC

This archive was generated by hypermail 2.3.1 : Monday, 13 April 2015 23:09:32 UTC