[Webkit-unassigned] [Bug 152883] New: User Agent style sheet should include !important directive when defining display:none on [hidden] attribute selector

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Jan 8 01:47:43 PST 2016


https://bugs.webkit.org/show_bug.cgi?id=152883

            Bug ID: 152883
           Summary: User Agent style sheet should include !important
                    directive when defining display:none on [hidden]
                    attribute selector
    Classification: Unclassified
           Product: WebKit
           Version: Safari 9
          Hardware: Unspecified
                OS: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: CSS
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: jcraig at apple.com

User Agent style sheet should include !important directive when defining display:none on [hidden] attribute selector...

WebKit uses the WHATWG spec recommendation for display:none on html:*[hidden]

> [hidden], area, base, basefont, datalist, head, link, menu[type=context i], meta,
> noembed, noframes, param, rp, script, source, style, template, track, title {
>   display: none;
> }

https://html.spec.whatwg.org/multipage/rendering.html#hiddenCSS

...but as specified, the behavior of @hidden is too easy to accidentally override.

<div hidden> example </div>

Even a simple element selector negates the usefulness of the @hidden API and causes the element to be displayed.
div { display: block; }

And the API no longer works on any element matching an author defined display rule.
el.hidden = true; // Does nothing.

I believe the solution is to change the user agent CSS (and the ultimately the HTML specs) to include this rule block:

[hidden] {
  display: none !important;
}

This way the @hidden API leverages a higher specificity than all common CSS selectors.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-unassigned/attachments/20160108/1cb144f4/attachment.html>


More information about the webkit-unassigned mailing list