Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EXPAND :has() to include support for more pseudo-classes #555

Closed
3 tasks done
jensimmons opened this issue Oct 5, 2023 · 5 comments
Closed
3 tasks done

EXPAND :has() to include support for more pseudo-classes #555

jensimmons opened this issue Oct 5, 2023 · 5 comments
Labels
focus-area-proposal Focus Area Proposal

Comments

@jensimmons
Copy link
Contributor

Description

:has() is amazing.
Developers are thrilled.

Some of the most interesting usecases are when you put another pseudo-class inside of :has(). For example, :has(:playing) targets an element if there's a video or audio element playing inside of it. :has(:user-invalid) targets an element if there's a form field inside of it that's in an invalid state — making it very easy, for example, to create a red border on a text label when its field is not filled out correctly.

It would be great to see if we can get support for all of the pseudo-class (except, of course, for the ones that are disallowed in the standard).

I started a spreadsheet to try and list what's currently supported where: https://docs.google.com/spreadsheets/d/1NZeNiJqOEiphHJiAIB9iWsp2yxsn8fsqAJj1syM6K10/edit?usp=sharing

It needs work, but the list of the pseudo-classes alone are helpful.

Specification

https://drafts.csswg.org/selectors/#relational

Open Issues

No response

Tests

No response

Current Implementations

  • Blink
  • Gecko
  • WebKit

Standards Positions

No response

Browser bug reports

No response

Developer discussions

No response

Polls & Surveys

No response

Existing Usage

No response

Workarounds

No response

Accessibility Impact

No response

Privacy Impact

No response

Other

No response

@jensimmons jensimmons added the focus-area-proposal Focus Area Proposal label Oct 5, 2023
@jensimmons jensimmons changed the title Extend :has() to include support for pseudo-classes EXPAND: :has() to include support for pseudo-classes Oct 5, 2023
@jensimmons jensimmons changed the title EXPAND: :has() to include support for pseudo-classes EXPAND :has() to include support for pseudo-classes Oct 5, 2023
@dbaron
Copy link
Member

dbaron commented Oct 6, 2023

Are there particular examples of pseudo-classes where:

  • an engine supports :has(),
  • an engine supports the pseudo-class,
  • the pseudo-class isn't forbidden by the spec from matching inside of :has(), and
  • the engine doesn't support the pseudo-class inside of :has()?

(I just tested :hover and :checked inside of :has() in Chrome Canary, and they worked fine.)

@nt1m
Copy link
Member

nt1m commented Oct 7, 2023

@dbaron Matching works fine in most browsers, it's mostly invalidation that needs work, although both Chrome & WebKit have made progress in that area over the past year.

@foolip
Copy link
Member

foolip commented Oct 10, 2023

A list of tests will be need to evaluate the work required for this proposal, as it's not clear if there are things that don't work in Chrome here, beyond pseudo-classes that aren't supported at all yet.

@jensimmons jensimmons changed the title EXPAND :has() to include support for pseudo-classes EXPAND :has() to include support for more pseudo-classes Oct 10, 2023
@bennypowers
Copy link

Does this include :host(:has())?

@jgraham
Copy link
Contributor

jgraham commented Feb 1, 2024

Thank you for proposing EXPAND :has() to include support for more pseudo-classes for inclusion in Interop 2024.

We wanted to let you know that this proposal was not selected to be part of Interop this year.

We could not find any tests for EXPAND :has() to include support for more pseudo-classes in the Web Platform Tests. Such tests are crucial for measuring interoperability status and progress. Once there are WPT entries covering this proposal, we welcome it being resubmitted for a future round of Interop.

For an overview of our process, see proposal selection. Thank you again for contributing to Interop 2024!

Posted on behalf of the Interop team.

@jgraham jgraham closed this as completed Feb 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
focus-area-proposal Focus Area Proposal
Projects
Status: Done
Development

No branches or pull requests

6 participants