This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 13283 - Current definition for [hidden] is not very useful for Web application developers. Every style rules in the author style sheet have to contain :not([hidden]) in their selectors to not override 'display' property for [hidden] elements.
Summary: Current definition for [hidden] is not very useful for Web application develo...
Status: RESOLVED WONTFIX
Alias: None
Product: HTML WG
Classification: Unclassified
Component: LC1 HTML5 spec (show other bugs)
Version: unspecified
Hardware: Other other
: P3 normal
Target Milestone: ---
Assignee: Ian 'Hixie' Hickson
QA Contact: HTML WG Bugzilla archive list
URL: http://www.whatwg.org/specs/web-apps/...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-07-18 07:01 UTC by contributor
Modified: 2011-08-10 23:06 UTC (History)
9 users (show)

See Also:


Attachments

Description contributor 2011-07-18 07:01:25 UTC
Specification: http://www.whatwg.org/specs/web-apps/current-work/complete.html
Multipage: http://www.whatwg.org/C#hidden-elements
Complete: http://www.whatwg.org/c#hidden-elements

Comment:
Current definition for [hidden] is not very useful for Web application
developers.  Every style rules in the author style sheet have to contain
:not([hidden]) in their selectors to not override 'display' property for
[hidden] elements.

Posted from: 58.138.63.189
User agent: Mozilla/5.0 (Windows NT 5.1) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.742.112 Safari/534.30
Comment 1 Tab Atkins Jr. 2011-07-18 17:59:37 UTC
Hmm, this is true.  Presentational attributes apply with lower precedence than any author CSS, which means it would be relatively easy to accidentally set the 'display' on a hidden element to something other than 'none'.

Perhaps we should define this as acting at a different specificity level.  It should be more specific than author styles, but less specific than author !important styles.  That leaves us with it being either between author and user, between user and @style, or between @style and author !important.  I don't know which one would be best.
Comment 2 Jonas Sicking (Not reading bugmail) 2011-07-18 18:04:04 UTC
One way to specify it would be to say that the UA stylesheet contains a rule like:

*[hidden] {
  display: none !important;
}
Comment 3 Tab Atkins Jr. 2011-07-18 18:18:35 UTC
(In reply to comment #2)
> One way to specify it would be to say that the UA stylesheet contains a rule
> like:
> 
> *[hidden] {
>   display: none !important;
> }

Except that CSS doesn't officially recognize the notion of a UA !important rule for some reason.  Of course, all the browsers use that to some extent.
Comment 4 Michael[tm] Smith 2011-08-04 05:03:30 UTC
mass-moved component to LC1
Comment 5 Ian 'Hixie' Hickson 2011-08-10 23:06:51 UTC
EDITOR'S RESPONSE: This is an Editor's Response to your comment. If you are satisfied with this response, please change the state of this bug to CLOSED. If you have additional information and would like the editor to reconsider, please reopen this bug. If you would like to escalate the issue to the full HTML Working Group, please add the TrackerRequest keyword to this bug, and suggest title and text for the tracker issue; or you may create a tracker issue yourself, if you are able to do so. For more details, see this document:
   http://dev.w3.org/html5/decision-policy/decision-policy.html

Status: Rejected
Change Description: no spec change
Rationale: 

We definitely don't want to prevent authors from changing how hidden="" is implemented at the CSS level. For example, I have in the past changed it to opacity:0 so that I can do animations on opacity using transitions. One could do similar things with other properties, e.g. height:0 to do a roll-up.

I do agree that it is rather annoying that every rule with 'display' in it ends up wacking the default [hidden] rule. Not sure what we can do about it though. It's not really any different than the way you have to be careful about not blowing away the 'display' property of <table> or the 'font' property of <h1> or whatnot. I'm skeptical about adding a new layer to the cascade; first the cascade is pretty complex already, and second it would be confusing to suddenly have this one feature that has to be overridden by !important.

If anyone has any other ideas, though, we should definitely consider them.