A simple example: #myform:has(input:checked) .row { background: rebeccapurple; } Toggling of the checkbox does not toggle that background color, but it really seems that it should. I created a test case with more details here: https://codepen.io/kbav/pen/YzrxwBa?editors=1100 This is a new bug created per request from Antti Koivisto on https://bugs.webkit.org/show_bug.cgi?id=227702 , the tracking bug for :has() implementation. I also just noticed that Lea Verou also opened https://bugs.webkit.org/show_bug.cgi?id=234556 , which seems related, though in my test case, the :has() styling _does_ work at startup for identifying an <input type="checkbox" checked /> is :checked — it just does not correctly identify the toggling of the checkbox and invalidate the style.
It only recognizes the checked when it's the first input in my experience. Here's a quick sample I hacked up: https://codesandbox.io/s/silly-gagarin-y0cub?file=/index.html
Created attachment 447791 [details] Patch
This patch modifies the imported WPT tests. Please ensure that any changes on the tests (not coming from a WPT import) are exported to WPT. Please see https://trac.webkit.org/wiki/WPTExportProcess
Submitted web-platform-tests pull request: https://github.com/web-platform-tests/wpt/pull/32168
Created attachment 447797 [details] Patch
I experience a lot of similar things for other pseudo-selectors. I am not sure if that's helpful but wanted to get it out there in case it saves some time somewhere. Exact same demo but with `:disabled`: https://codesandbox.io/s/nostalgic-minsky-v0yyi?file=/index.html
Created attachment 447801 [details] Patch
Committed r287363 (245505@main): <https://commits.webkit.org/245505@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 447801 [details].
<rdar://problem/86817296>
The problem seems to still be present for select elements. I've opened a separate issue for this: https://bugs.webkit.org/show_bug.cgi?id=235451
STP138 was based on a fairly old revision and did not yet include this fix.
*** Bug 235451 has been marked as a duplicate of this bug. ***