Repository navigation
Open
Labels
focus-area-proposalFocus Area Proposal
Description
Description
A very good and detailed explainer for CSSPseudoElement can be found here.
For Interop 2027, it would be great to have this available cross-engine. It is currently only available in Chromium and behind a flag in Firefox.
My primary motivation is for the ::backdrop pseudo element. Currently to detect backdrop clicks, it requires elaborative hacky workarounds such as event.target, getBoundingClientRect(), extra divs etc. They shouldn't be needed.
Example
dialog.addEventListener('click', (event) => {
if (event.pseudoTarget?.type === '::backdrop') {
dialog.close();
}
});- https://github.com/danielsakhapov/CSSPseudoElementDoc
- https://developer.mozilla.org/en-US/docs/Web/API/CSSPseudoElement
- Add .pseudoTarget property to selected event types w3c/uievents#413
- [css-pseudo] Add ::backdrop and ::view-transitions to the CSSPseudoElement's allowed pseudo-elements list w3c/csswg-drafts#13804
Specification
W3C
web-feature
web-platform-dx/web-features#4306
Test Links
- https://wpt.fyi/results/css/css-pseudo/backdrop-pseudo-element-click.tentative.html?label=master&label=experimental&aligned&q=backdrop
- https://wpt.fyi/results/css/css-pseudo?label=master&label=experimental&aligned&q=CSSPseudoElement
Additional Signals
Reacted by Zach Saucier, Arif, Christopher Kirk-Nielsen, Chris Couzens, jack, CuriousMissFox , Ido Rosenthal, Joe Pea, phantomxx29474, Martin Shelley and 12 more
Metadata
Metadata
Assignees
Labels
focus-area-proposalFocus Area Proposal
Type
Projects
- StatusShow more project fieldsTodo
Activity
github-actions commentedon Sep 3, 2026
This comment was automatically generated based on the information you provided. Please don't edit it.
No web features (from the web-features project) were found in your proposal. If your proposal doesn't correspond to a web feature, that is fine.
Otherwise, please update your initial comment to include
web-features: <feature-id>.To find feature IDs, use the web-features explorer.
lukewarlow commentedon Sep 3, 2026
Fwiw for your specific example the closedby attribute on dialogs is probably a better solution.
jackholden commentedon Sep 3, 2026
@lukewarlow
Unfortunately it isn't in Safari yet and I need to support a few versions prior. Additionally, when the backdrop is clicked, I needed to perform some logic as well as detect how the dialog was closed. With closedby, does that provide an easy mechanism for doing the same? :)
Hopefully one day Safari can move to a release model similar to Firefox and Chrome.
jgraham commentedon Sep 10, 2026
Does this have more than one test? Is the spec stable enough that the test(s) could reasonably be moved out of the tentative state?