re: Bug 19277 - Relationship and precedence of hidden="" and display:none should be clarified/defined

https://www.w3.org/Bugs/Public/show_bug.cgi?id=19277

The hidden="" attribute is supported in every shipping major browser
and, in all cases, it is implemented with a simple entry in the UA
stylesheet:

[hidden] {
  display: none;
}

In comment #1 on this bug, Michael Cooper records that the A11Y TF
"concluded that the spec should say explicitly that hidden='' trumps all
CSS." I hope the TF finds the below rationale sufficient to reverse this
conclusion.

# Harm

There is no accessibility concern with the current implementation of
hidden="". As James Craig said in comment #17, "this is a non-issue for
accessibility, as long as the UA has a default rule implemented via
display:none." It follows that we might run into new accessibility
issues if we change the default rule, or require behavior inexpressible
by the current default rule.

# Magic

One of the things that's nice about defining hidden="" on top of
display: none is that there's no magic involved. Its behavior is
completely explained by the existing platform features that it's built
on (namely, CSS, its display property, and CSS's interaction with the
A11Y layer). This is in line with recent Web platform design principles
espoused by the TAG.

As Henri put it in comment #14, "I think it’s a bad idea to make @hidden
have CSS rendering effects that don’t fully follow from its
CSS-expressible characteristics. We really don’t need more non-CSS
rendering directives in the Web platform." Boris, in comment #13: "In
general, adding one-off exceptions to CSS processing carries a very
heavy implementation burden due to the complexity it causes. Absent
extremely strong justification, I would be opposed to adding such
exceptions." And in comment #16: "I would very very strongly prefer that
whatever we decide to do here is done via defining styles on elements
with the 'hidden' attribute set instead of defining new magic."

# Flexibility

Another benefit to defining hidden="" in this way is that authors may
override the way hidden="" works to better suit their document or
application. For instance, in some cases it might make more sense to
implement hidden="" with the following CSS:

[hidden] {
  visibility: hidden;
}

# Compat

Like I said above, hidden="" is shipping in all major browsers, and all
implementations agree on its implementation. I concur with Boris'
comments (#2 and #16): it would be a mistake to break compat with all
shipping major browsers here.

# Conclusion

I intend to resolve bug 19277 WONTFIX given the above rationale. Please
let me know if I've missed anything.

# Other thoughts

Another possibility was for us to define hidden="" like so in the UA
stylesheet:

[hidden] {
  display: none !important;
}

While I sympathize with Tab's rationale in comment #8 (and had made the
same argument myself in an earlier mailing list thread), I think there
are two reasons to not do this. The first point was raised by Boris in
comment #16: "Making things with @hidden "display: none !important" in
the UA stylesheet would mean web [pages] cannot override the display at
all, ever." Secondly, it's possible for authors to opt-in to such a
behavior by adding this rule to one of their page stylesheets.


Thanks,
Ted

Received on Thursday, 21 November 2013 19:06:38 UTC