Skip to content

CSSPseudoElement #1347

Open
Open

Description

@jackholden

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();
  }
});

Specification

W3C

web-feature

web-platform-dx/web-features#4306

Test Links

Additional Signals

Activity

  1. github-actions commented on Sep 3, 2026

    @github-actions

    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.

  2. lukewarlow commented on Sep 3, 2026

    @lukewarlow
    Member

    Fwiw for your specific example the closedby attribute on dialogs is probably a better solution.

  3. jackholden commented on Sep 3, 2026

    @jackholden
    Author

    Fwiw for your specific example the closedby attribute on dialogs is probably a better solution.

    @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.

  4. jgraham commented on Sep 10, 2026

    @jgraham
    Contributor

    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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    focus-area-proposal

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions