Closed Bug 1876962 Opened 10 months ago Closed 9 months ago

Firefox doesn't redraw blocks after changing :has(:target) state

Categories

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

Firefox 122
defect

Tracking

()

VERIFIED FIXED
124 Branch
Tracking Status
firefox124 --- verified
firefox125 --- verified

People

(Reporter: siemenskun, Assigned: dshin)

References

(Blocks 1 open bug)

Details

Attachments

(4 files, 3 obsolete files)

Attached file has-target-bug.html

Steps to reproduce:

  1. Open has-target-bug.html
  2. Click on links t1, t2, t3 in any order any number of times

Actual results:

Firefox doesn't redraw blocks after losing, and sometimes after getting :has(:target) on a block.
So there could be multiple blocks that are rendered as "targeted!" while this can't be true because they're siblings.
Sometimes after the page refresh all three elements shows "targeted!".

I've added :hover to make the issue clear. After forced redrawing caused by hovering over, all blocks are rendered correctly, and only the proper one shows " targeted".

Expected results:

After clicking "t1", the text content should look like this:
t1 targeted!
t2
t3

After clicking "t2", the text content should look like this:
t1
t2 targeted!
t3

After clicking "t3", the text content should be:
t1
t2
t3 targeted!

After refreshing the page, the text context should correspond to the anchor in the address bar.

It works in Chromium 107.0.5304.88 as expected.

Component: Untriaged → CSS Parsing and Computation
Product: Firefox → Core
Blocks: has-issues
Flags: needinfo?(dshin)
Severity: -- → S3
Status: UNCONFIRMED → NEW
Ever confirmed: true
Priority: -- → P3
Assignee: nobody → dshin
Flags: needinfo?(dshin)
Attachment #9377466 - Attachment is obsolete: true
Attachment #9377465 - Attachment is obsolete: true
Attachment #9377467 - Attachment is obsolete: true

Would generate invalid results :has() selector if it's in the subject
compound but also uses a pseudo-selector (e.g. .foo:has(.bar)::after).

Was added in bug 1793012. No longer needed since :has is part of
reinvalidation selectors now. The new approach can be potentially-
pricey, but is a lot simpler.

Depends on D200223

Attachment #9377515 - Attachment description: Bug 1876962: Part 2 - Add `:has` to reinvalidation selector. r=#style → Bug 1876962: Part 2 - Add `:has` to revalidation selector. r=#style
See Also: → 1878608
Pushed by dshin@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/e0d1a0931b11 Part 1 - Fix up logic for determining `Rightmost` in `matches_selector`. r=firefox-style-system-reviewers,emilio https://hg.mozilla.org/integration/autoland/rev/9032a37ea009 Part 2 - Add `:has` to revalidation selector. r=firefox-style-system-reviewers,emilio https://hg.mozilla.org/integration/autoland/rev/a30b42d227dd Part 3 - Remove special case handling for `:has` in style sharing. r=firefox-style-system-reviewers,emilio
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/44539 for changes under testing/web-platform/tests
Status: NEW → RESOLVED
Closed: 9 months ago
Resolution: --- → FIXED
Target Milestone: --- → 124 Branch
Upstream PR merged by moz-wptsync-bot
Upstream PR merged by moz-wptsync-bot
Flags: qe-verify+

Reproducible on a 2024-02-10 Nightly build on macOS 12.
Verified as fixed on Firefox 124.0b2 and Firefox Nightly 125.0a1 on macOS 12, Windows 10, Ubuntu 22.

Status: RESOLVED → VERIFIED
Flags: qe-verify+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: