Closed Bug 1875137 Opened 8 months ago Closed 8 months ago

:has in display:none doesn't behave as expected

Categories

(Core :: CSS Parsing and Computation, defect, P2)

Firefox 121
defect

Tracking

()

RESOLVED FIXED
123 Branch
Tracking Status
firefox123 --- fixed

People

(Reporter: coals-worker0q, Assigned: emilio)

References

(Blocks 1 open bug)

Details

Attachments

(2 files)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.2.1 Safari/605.1.15

Steps to reproduce:

Using :has in combination with other selectors seems to have no effect, unless some action is taken to cause the browser to 'redraw'.

I made 3 reproduced examples for the Mozilla team here: https://2a476f4e.spence.pages.dev/debug/

Actual results:

The conditions that should trigger the has selector don't initially take any effect. After, however, if anything is done to cause the page to be "redrawn", such as resizing the window, changing the zoom amount, or opening the dev console, then the CSS rules related to the has selector will be triggered.

Expected results:

The has selector should update the applicable CSS properties when conditions call for it do so.

The Bugbug bot thinks this bug should belong to the 'Core::CSS Parsing and Computation' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → CSS Parsing and Computation
Product: Firefox → Core
Assignee: nobody → dshin
Blocks: has-issues
Attached file reduced test-case

Invalidation issue if the relevant element is display: none (if you remove display: none from the div container it works).

I'm going to bet this. David, do you have cycles to look?

Flags: needinfo?(dshin)

Just like we do for attribute invalidation.

Actually just confirmed that's the issue.

Flags: needinfo?(dshin)
Summary: :has doesn't behave as expected → :has indoesn't behave as expected
Assignee: dshin → emilio
Status: UNCONFIRMED → NEW
Ever confirmed: true
Priority: -- → P2
Pushed by ealvarez@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/68ff26df3346
Don't ignore state changes in display: none subtrees if needed for :has(). r=dshin
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/44070 for changes under testing/web-platform/tests
Duplicate of this bug: 1875110
Summary: :has indoesn't behave as expected → :has in display:none doesn't behave as expected
Status: NEW → RESOLVED
Closed: 8 months ago
Resolution: --- → FIXED
Target Milestone: --- → 123 Branch
Upstream PR merged by moz-wptsync-bot
Duplicate of this bug: 1880036
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: