Bug 152674 - Elements with the "hidden" attribute still show up if "display: flex;"
Summary: Elements with the "hidden" attribute still show up if "display: flex;"
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: WebKit Nightly Build
Hardware: All All
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2016-01-03 16:26 PST by Devin Rousso
Modified: 2016-02-05 13:57 PST (History)
7 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Devin Rousso 2016-01-03 16:26:47 PST
* STEPS TO REPRODUCE:
1. Enter the following into the snippet editor:

<div style="display: flex; width: 50px; height: 50px; background-color: red;" hidden></div>
Comment 1 Radar WebKit Bug Importer 2016-01-03 16:26:58 PST
<rdar://problem/24034110>
Comment 2 Joseph Pecoraro 2016-01-04 16:22:33 PST
I believe this is behaving correctly. We match Firefox and Chrome here.

Web Inspector shows the style cascade being:

  inline style:
    display: flex

  html attributes: (from `hidden`)
    display: none

  user agent styles for `div`:
    display: block

The HTML Attributes section could just as easily have been treated as a user agent style like that recommended in the HTML spec:
https://html.spec.whatwg.org/multipage/interaction.html#the-hidden-attribute
https://html.spec.whatwg.org/multipage/rendering.html#hiddenCSS
    
  [hidden] {
    display: none;
  }

In which case, the more-specific inline style of `display: flex` overrides it.

User styles (page styles) can include their own styles to make the hidden attribute stronger...

  [hidden] {
    display: none !important;
  }

... but I think right now we are behaving as expected.
Comment 3 Devin Rousso 2016-01-04 16:25:09 PST
(In reply to comment #2)
> [hidden] {
>     display: none;
> }

Alright, well this is what I used anyways so I guess it's fine. Just not at all what I expected. Applying "hidden" to an element should hide it from view (at least that's how I take it)...