Add a global [hidden] { display: none !important } rule instead of :not([hidden]) display guards
Categories
(Toolkit :: Themes, task)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox154 | --- | fixed |
People
(Reporter: dao, Assigned: dao)
References
Details
Attachments
(1 file)
[hidden] is implemented as a low-priority presentation attribute (see the comment in layout/style/res/html.css), so any author rule setting display silently overrides it. To work around this, a lot of chrome/in-content CSS guards display-setting rules with :not([hidden]) (e.g. foo:not([hidden]) { display: flex }) so the element still hides when the hidden attribute is set.
Add a single [hidden] { display: none !important } rule to the two base stylesheets -- global-shared.css (chrome, via global.css) and in-content/common-shared.css (in-content pages, via in-content/common.css) -- so callers can set a display type unconditionally, and drop the redundant :not([hidden]) guards.
Notes:
- Rules that intentionally re-show a
[hidden]element viadisplayneed!importantto keep winning:findbar[hidden](slide transition),treecol[hidden]inxul.css(column collapse), andsetting-control[hidden]:has(> moz-message-bar). - Guards are kept where the base rule can't reach: shadow-DOM widgets, the newtab/activity-stream bundle,
browser/fxr/*, and mixed-coverage sheets injected into content docs or shadow roots (urlbar view sheets via the smartbar, feature-callout sheets). - Structural
:not([hidden])uses (sibling/descendant combinators) are untouched.
| Assignee | ||
Comment 1•21 days ago
|
||
[hidden] is implemented as a low-priority presentation attribute (see the
comment in layout/style/res/html.css), so any author rule setting display
silently overrides it. A lot of chrome/in-content CSS therefore guards
display-setting rules with :not([hidden]) so the element still hides when the
hidden attribute is set.
Add a single [hidden] { display: none !important } rule to the two base
stylesheets -- global-shared.css (chrome) and in-content/common-shared.css
(in-content pages) -- so callers can set a display type unconditionally, and
drop the redundant :not([hidden]) guards.
Rules that intentionally re-show a [hidden] element via display keep working
via !important: findbar[hidden] (slide transition), treecol[hidden] in xul.css
(column collapse), and setting-control[hidden]:has(> moz-message-bar). Guards are
kept where the base rule can't reach: shadow-DOM widgets, the
newtab/activity-stream bundle, browser/fxr/*, and mixed-coverage sheets injected
into content documents or shadow roots (urlbar view sheets via the smartbar,
feature-callout sheets). Structural :not([hidden]) uses (sibling/descendant
combinators) are untouched.
Updated•21 days ago
|
Backed out for causing mochitests failures @ browser_webconsole_location_logpoint_debugger_link.js
| Assignee | ||
Updated•20 days ago
|
Comment 6•19 days ago
|
||
| bugherder | ||
Description
•