Closed Bug 1867893 Opened 2 years ago Closed 2 years ago

has pseudo selector (caching?) issue when child includes focused input

Categories

(Core :: CSS Parsing and Computation, defect)

Firefox 122
defect

Tracking

()

RESOLVED FIXED
122 Branch
Tracking Status
firefox-esr115 --- unaffected
firefox120 --- unaffected
firefox121 --- fixed
firefox122 --- fixed

People

(Reporter: krassowski.michal, Assigned: dshin)

References

(Regression)

Details

(Keywords: regression)

Attachments

(4 files)

Attached file has.html

Steps to reproduce:

The :has() pseudo-class does not appear to be evaluated correctly when a focused input element is contained in the selected node.

To reproduce:

  1. Open the attached has.html file in Firefox 122.0a1 (2023-11-27) (64-bit)
  2. (Optional) double-check that layout.css.has-selector.enabled is true
  3. Click "Run" button
  4. Wait 1 second

Actual results:

Inputs numbered 0-99 are all shown (bad). When you open developer tools to investigate inputs 0-98 get hidden leaving input 99 (good).

Expected results:

Only input 99 is shown after running and waiting 1 second.

Attached image repro.gif

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
Attached image works-in-chromium.gif

This works correctly in Chromium-based browsers.

It appears that a similar scenario with a simpler selector like:

.parent:has(.child) {
  display: none;
}

works well in both Chromium and Firefox Nightly.

David, looks like a :has() style invalidation bug, mind taking a look?

Blocks: has-pseudo
Severity: -- → S3
Status: UNCONFIRMED → NEW
Ever confirmed: true
Flags: needinfo?(dshin)
Assignee: nobody → dshin
Status: NEW → ASSIGNED
Flags: needinfo?(dshin)
Pushed by dshin@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/72f1c72ea34c Do not skip invalidation for `:has` if the stand-in element can be an anchor. r=emilio
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/43498 for changes under testing/web-platform/tests
Keywords: regression
Regressed by: 1853258

Set release status flags based on info from the regressing bug 1853258

Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 122 Branch
Upstream PR merged by moz-wptsync-bot

The patch landed in nightly and beta is affected.
:dshin, is this bug important enough to require an uplift?

  • If yes, please nominate the patch for beta approval.
  • If no, please set status-firefox121 to wontfix.

For more information, please visit BugBot documentation.

Flags: needinfo?(dshin)

Comment on attachment 9366878 [details]
Bug 1867893: Do not skip invalidation for :has if the stand-in element can be an anchor. r=emilio

Beta/Release Uplift Approval Request

  • User impact if declined: Incorrect invalidation of some :has() selectors, as shown in Bug 1867893 comment 0.
  • Is this code covered by automated tests?: Yes
  • Has the fix been verified in Nightly?: Yes
  • Needs manual test from QE?: No
  • If yes, steps to reproduce:
  • List of other uplifts needed: None
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky):
  • String changes made/needed: N/A
  • Is Android affected?: Yes
Flags: needinfo?(dshin)
Attachment #9366878 - Flags: approval-mozilla-beta?

Comment on attachment 9366878 [details]
Bug 1867893: Do not skip invalidation for :has if the stand-in element can be an anchor. r=emilio

Approved for 121.0b8.

Attachment #9366878 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
Flags: in-testsuite+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: