<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>235451</bug_id>
          
          <creation_ts>2022-01-21 12:29:42 -0800</creation_ts>
          <short_desc>[:has() pseudo-class] :has() selector invalidation issue with toggling :checked on select elements</short_desc>
          <delta_ts>2022-01-24 07:57:00 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>CSS</component>
          <version>Safari Technology Preview</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>DUPLICATE</resolution>
          <dup_id>234561</dup_id>
          <see_also>https://bugs.webkit.org/show_bug.cgi?id=234561</see_also>
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Bramus">bramus</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>koivisto</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1832846</commentid>
    <comment_count>0</comment_count>
    <who name="Bramus">bramus</who>
    <bug_when>2022-01-21 12:29:42 -0800</bug_when>
    <thetext>I see that https://bugs.webkit.org/show_bug.cgi?id=234561 got closed as RESOLVED FIXED, but I have similar a demo that&apos;s not working properly: https://codepen.io/bramus/pen/exrYVW

When changing the value of the first dropdown, it should enable the corresponding dropdown which is a sibling. 

```html
&lt;select&gt;
  &lt;option value=&quot;0&quot;&gt;Choose …&lt;/option&gt;
  &lt;option value=&quot;1&quot;&gt;Audi&lt;/option&gt;
  &lt;option value=&quot;2&quot;&gt;BMW&lt;/option&gt;
  &lt;option value=&quot;3&quot;&gt;Ford&lt;/option&gt;
  &lt;option value=&quot;4&quot;&gt;Mercedes&lt;/option&gt;
&lt;/select&gt;

&lt;select data-showwhen=&quot;1&quot;&gt;
  &lt;option value=&quot;0&quot;&gt;Choose type of Audi …&lt;/option&gt;
  …
&lt;/select&gt;

&lt;select data-showwhen=&quot;2&quot;&gt;
  &lt;option value=&quot;0&quot;&gt;Choose type of BMW …&lt;/option&gt;
  …
&lt;/select&gt;

&lt;select data-showwhen=&quot;3&quot;&gt;
  &lt;option value=&quot;0&quot;&gt;Choose type of Ford …&lt;/option&gt;
  …
&lt;/select&gt;

&lt;select data-showwhen=&quot;4&quot;&gt;
  &lt;option value=&quot;0&quot;&gt;Choose type of Mercedes …&lt;/option&gt;
  …
&lt;/select&gt;
```

```css
select[data-showwhen] {
  cursor: not-allowed;
  pointer-events: none;
  opacity: 0.5;
}

select:not([data-showwhen]):has(option[value=&quot;1&quot;]:checked) ~ select[data-showwhen=&quot;1&quot;],
select:not([data-showwhen]):has(option[value=&quot;2&quot;]:checked) ~ select[data-showwhen=&quot;2&quot;],
select:not([data-showwhen]):has(option[value=&quot;3&quot;]:checked) ~ select[data-showwhen=&quot;3&quot;],
select:not([data-showwhen]):has(option[value=&quot;4&quot;]:checked) ~ select[data-showwhen=&quot;4&quot;] {
  cursor: default;
  pointer-events: auto;
  opacity: 1;
}
```

When changing the value of the first dropdown, nothing happens, although it should. Perhaps it has to do that these are select elements, and not input elements?

Forcing a style recall + repaint does not help:

```js
// Force a repaint on change
document.querySelector(&apos;select&apos;).addEventListener(&apos;input&apos;, (e) =&gt; {
	document.documentElement.className = &apos;reflow_&apos; + (new Date()).getTime();
});
```


What does work is opening Web Inspector: after changing the value of the first dropdown and then focussing Web Inspector, the page seems to get restyled and pained. The confirms that the CSS itself works.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1833251</commentid>
    <comment_count>1</comment_count>
    <who name="Antti Koivisto">koivisto</who>
    <bug_when>2022-01-24 04:16:05 -0800</bug_when>
    <thetext>Looks fine with trunk. 

STP138 was based on a fairly old revision and did not yet include this fix.

*** This bug has been marked as a duplicate of bug 234561 ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1833315</commentid>
    <comment_count>2</comment_count>
    <who name="Bramus">bramus</who>
    <bug_when>2022-01-24 07:57:00 -0800</bug_when>
    <thetext>Thanks for clarifying, Antti.

Looking forward to STP 139 then ;)</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>