<?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>325152</bug_id>
          
          <creation_ts>2026-09-24 07:21:41 -0700</creation_ts>
          <short_desc>:open stops matching a select whose base appearance picker is still showing</short_desc>
          <delta_ts>2026-10-04 22:47:49 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>Forms</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          <see_also>https://github.com/web-platform-tests/wpt/pull/63235</see_also>
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          <blocked>325123</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Anne van Kesteren">annevk</reporter>
          <assigned_to name="Anne van Kesteren">annevk</assigned_to>
          <cc>cdumez</cc>
    
    <cc>webkit-bug-importer</cc>
    
    <cc>wenson_hsieh</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>2254078</commentid>
    <comment_count>0</comment_count>
      <attachid>481541</attachid>
    <who name="Anne van Kesteren">annevk</who>
    <bug_when>2026-09-24 07:21:41 -0700</bug_when>
    <thetext>Created attachment 481541
test

Rebuilding a select&apos;s renderers while its base appearance picker is open leaves the
picker on screen but stops :open from matching. The picker keeps rendering its options
and keeps keyboard focus, so any styling or scripting keyed on :open is wrong for as
long as the picker stays up.

Steps, with the attached test or by hand:
1. &lt;select style=&quot;appearance: base-select&quot;&gt; with ::picker(select) { appearance: base-select }.
2. Click it to open the picker.
3. From the console, select.size = 1.

Measured before and after step 3:

  opened:        :open=true   option rendered=true  activeElement=option
  after rebuild: :open=false  option rendered=true  activeElement=option

Setting size from absent to 1 leaves it a dropdown box but calls
invalidateStyleAndRenderersForSubtree(), and didDetachRenderers()
(HTMLSelectElement.cpp:168) then clears m_popupIsVisible unconditionally. That is
correct for the native popup menu it tears down in the same breath, but a base
appearance picker is a popover whose showing state is independent of the select&apos;s
renderers, so it survives the rebuild while the flag does not.

The underlying problem is that :open is a single stored flag,

  bool HTMLSelectElement::isOpen() const { return m_popupIsVisible; }

serving two owners with different lifetimes: the native popup menu, which dies with the
renderers, and the picker popover, which does not. Anything that tears renderers down
clobbers state belonging to the other owner.

Patching it by clearing on detach and restoring on attach works but leaves two hooks
agreeing about a fact neither owns. The fix that removes the class of bug is to stop
storing it and derive it, so there is no moment when the flag can be wrong:

  bool HTMLSelectElement::isOpen() const
  {
	  if (RefPtr popover = m_popover; popover &amp;&amp; /* base picker */)
		  return popover-&gt;isPopoverShowing();
	  return m_popupIsVisible;
  }

Two things make that a real change rather than a tweak. :open invalidation currently
happens inside setPopupIsVisible(), so the popover&apos;s show and hide paths have to trigger
it instead. And isOpen() runs during selector matching, so the base picker test has to be
cheaper than usesBaseAppearancePicker(), which reads two computed styles.

The flag has 13 reads and 9 writes. The accessibility readers (AccessibilityMenuList,
AccessibilityRenderObject, AccessibilityObject) all want the native meaning and would keep
using it as-is; only isOpen() and SelectPopoverElement&apos;s check want the picker meaning.

This is not iOS-specific but also not reachable there: didDetachRenderers()&apos;s body is
entirely #if !PLATFORM(IOS_FAMILY), since m_popup does not exist on iOS.

The attached test fails on trunk at the third assertion — select.matches(&apos;:open&apos;) after the rebuild — while the two beside it, that the option still has a box and still has focus, pass and document that the picker really is showing.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2257280</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2026-10-01 07:22:14 -0700</bug_when>
    <thetext>&lt;rdar://problem/188911581&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2258174</commentid>
    <comment_count>2</comment_count>
    <who name="Anne van Kesteren">annevk</who>
    <bug_when>2026-10-03 00:13:28 -0700</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/75748</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2258175</commentid>
    <comment_count>3</comment_count>
    <who name="Anne van Kesteren">annevk</who>
    <bug_when>2026-10-03 00:14:41 -0700</bug_when>
    <thetext>Submitted web-platform-tests pull request: https://github.com/web-platform-tests/wpt/pull/63235</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2258660</commentid>
    <comment_count>4</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2026-10-04 22:47:46 -0700</bug_when>
    <thetext>Committed 322666@main (814ebe2cfe6a): &lt;https://commits.webkit.org/322666@main&gt;

Reviewed commits have been landed. Closing PR #75748 and removing active labels.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>481541</attachid>
            <date>2026-09-24 07:21:41 -0700</date>
            <delta_ts>2026-09-24 07:21:41 -0700</delta_ts>
            <desc>test</desc>
            <filename>select-renderer-rebuild-keeps-picker-open.html</filename>
            <type>text/html</type>
            <size>1167</size>
            <attacher name="Anne van Kesteren">annevk</attacher>
            
              <data encoding="base64">PCFET0NUWVBFIGh0bWw+CjxodG1sPgo8aGVhZD4KPHNjcmlwdCBzcmM9Ii4uLy4uLy4uLy4uL3Jl
c291cmNlcy9qcy10ZXN0LmpzIj48L3NjcmlwdD4KPHNjcmlwdCBzcmM9Ii4uLy4uLy4uLy4uL3Jl
c291cmNlcy91aS1oZWxwZXIuanMiPjwvc2NyaXB0Pgo8c3R5bGU+CnNlbGVjdCwgc2VsZWN0Ojpw
aWNrZXIoc2VsZWN0KSB7CiAgIC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