Open Bug 1739682 Opened 3 years ago Updated 8 months ago

Bare `::part(foo)` CSS selector selects parts inside shadow roots

Categories

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

Firefox 94
defect

Tracking

()

Tracking Status
firefox-esr91 --- affected
firefox94 --- wontfix
firefox95 --- wontfix
firefox96 --- wontfix

People

(Reporter: nolan, Unassigned)

References

(Regression, )

Details

(4 keywords)

Attachments

(1 file)

Attached file Minimal repro

User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:94.0) Gecko/20100101 Firefox/94.0

Steps to reproduce:

  1. Go to https://bl.ocks.org/nolanlawson/raw/cbc40307e15f99be6e084ac0fffb59be/

Actual results:

The <span> is blue.

Expected results:

The <span> should be blue, because it's being targeted with the CSS selector ::part(foo), which should not work.

According to a comment in this WebKit bug, the fact that it appears blue in Firefox should be considered a bug. WebKit and Chrome do not have this behavior, although WebKit just added support for :host::part(foo).

From a web developer POV, I'd say that ::part(foo) is problematic because it's ambiguous in cases where a custom element's shadow root contains another custom element with its own part that has the same name.

The <span> should be blue

Sorry, this is a typo. I meant "the <span> should not be blue."

Has STR: --- → yes
Component: Untriaged → CSS Parsing and Computation
Product: Firefox → Core
Regressed by: 1624968
Has Regression Range: --- → yes
Severity: -- → S3
Status: UNCONFIRMED → NEW
Ever confirmed: true
Priority: -- → P3

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

Can this be marked as a bug instead of wontfix? Please see: https://github.com/w3c/csswg-drafts/issues/9981 Thanks

Flags: needinfo?(mcastelluccio)

The bug is still open. It was sent to wontfix for firefox 95/96, because we're not fixing it in those versions.

It's a bit tricky to fix but probably not too terrible... We either fix the matching of ::part() to make sure that if we're on the same tree we have a featureless host selector to the left, or fix the rule collector to not look at those rules.

Flags: needinfo?(mcastelluccio)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: