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 23389 - The implementation symantics of the HTML hidden="hidden" attribute vs CSS display:none are not clear and in fact conflict
Summary: The implementation symantics of the HTML hidden="hidden" attribute vs CSS dis...
Status: RESOLVED WONTFIX
Alias: None
Product: HTML WG
Classification: Unclassified
Component: HTML5 spec (show other bugs)
Version: unspecified
Hardware: PC Windows NT
: P2 editorial
Target Milestone: ---
Assignee: steve faulkner
QA Contact: HTML WG Bugzilla archive list
URL:
Whiteboard:
Keywords: a11y
Depends on:
Blocks:
 
Reported: 2013-09-28 02:46 UTC by scunliffe.bugzilla
Modified: 2016-04-22 20:17 UTC (History)
8 users (show)

See Also:


Attachments

Description scunliffe.bugzilla 2013-09-28 02:46:18 UTC
From the current draft: http://www.w3.org/html/wg/drafts/html/master/single-page.html#the-hidden-attribute

"User agents should not render elements that have the hidden attribute specified."

As stated implies that user agents would be "in error" if displaying elements when this attribute is specified.

<side_rant>I presume there is a good accessibility reason for this new attribute but at the moment as a developer I only see trouble. I would love to see a clear indication as to why this addition is even needed in the first place.</side_rant>

I've created a jsbin demo showing the confusing behavior as it is currently implemented in browsers (Firefox & Chrome from my testing)

http://jsbin.com/IKohIXe/3/edit

In short since this new HTML attribute is currently "duplicating" the same behavior as the CSS property developers now have 2 'methods' of changing the physical rendering of elements yet the 2 accessors are not kept in sync and the true state of an element's display is not maintained causing "dirty data" when inspected.

In the test case above if an element was served up with hidden="hidden" but later JavaScript sets the CSS style "display:block" on the element the element becomes visible... however the hidden attribute that implies that it is not visible remains and HTMLElement.hidden returns true.

1.) Excluding any accessibility issues (which I'm presuming was the impetus for this feature addition in the first place) I don't see any helpful use for this attribute.
2.) IMHO, if the display of an element is altered to show through CSS the hidden attribute (if kept) should be removed from the DOM.
3.) If it was not the intention that the hidden attribute and the CSS display property were to affect each other in any way... then the current browser implementations do not match the intentions.
4.) As a developer it is already confusing enough with both the CSS display and visibility properties (especially when display can be "block|inline|{empty_string}|table-row|inline-block" etc.) adding yet another layer of the element is: "maybe, kinda, sorta-ish" hidden doesn't seem helpful at all to me.

Due to the inconsistencies I've already deemed use of this attribute verboten within my developer teams on Web Projects and from conversations with other developers the feeling is mutual.
Comment 1 steve faulkner 2013-09-28 07:53:51 UTC
this appears at first glance to be an browser implementation bug
Comment 2 steve faulkner 2013-09-28 15:05:32 UTC
I have filed a bug on Firefox https://bugzilla.mozilla.org/show_bug.cgi?id=921738 to get some implementer feedback. It may be that the spec is unclear and needs clarification or it may be that browsers need to fix their implementation.
Comment 3 steve faulkner 2013-09-28 18:24:51 UTC
(In reply to steve faulkner from comment #2)
> I have filed a bug on Firefox
> https://bugzilla.mozilla.org/show_bug.cgi?id=921738 to get some implementer
> feedback. It may be that the spec is unclear and needs clarification or it
> may be that browsers need to fix their implementation.

so it would seem that it is not considered a bug by one person at Mozilla:
https://bugzilla.mozilla.org/show_bug.cgi?id=921738#c1
Comment 4 steve faulkner 2013-09-28 18:32:57 UTC
note this brings up an issue in reference to the mapping of hidden to aria-hidden
Comment 5 Charles McCathieNevile 2015-06-12 14:48:46 UTC
Looks like this is related to 19159
Comment 6 Arron Eicholz 2016-04-22 20:17:13 UTC
HTML5.1 Bugzilla Bug Triage: won't fix, based on the feedback from https://bugzilla.mozilla.org/show_bug.cgi?id=921738 and the understanding that HTML and CSS are disconnected systems I don't think this should be changed.

If this resolution is not satisfactory, please copy the relevant bug details/proposal into a new issue at the W3C HTML5 Issue tracker: https://github.com/w3c/html/issues/new where it will be re-triaged. Thanks!