WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
325152
:open stops matching a select whose base appearance picker is still showing
https://bugs.webkit.org/show_bug.cgi?id=325152
Summary
:open stops matching a select whose base appearance picker is still showing
Anne van Kesteren
Reported
2026-09-24 07:21:41 PDT
Created
attachment 481541
[details]
test Rebuilding a select'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. <select style="appearance: base-select"> 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'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 && /* base picker */) return popover->isPopoverShowing(); return m_popupIsVisible; } Two things make that a real change rather than a tweak. :open invalidation currently happens inside setPopupIsVisible(), so the popover'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's check want the picker meaning. This is not iOS-specific but also not reachable there: didDetachRenderers()'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(':open') 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.
Attachments
test
(1.14 KB, text/html)
2026-09-24 07:21 PDT
,
Anne van Kesteren
no flags
Details
View All
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2026-10-01 07:22:14 PDT
<
rdar://problem/188911581
>
Anne van Kesteren
Comment 2
2026-10-03 00:13:28 PDT
Pull request:
https://github.com/WebKit/WebKit/pull/75748
Anne van Kesteren
Comment 3
2026-10-03 00:14:41 PDT
Submitted web-platform-tests pull request:
https://github.com/web-platform-tests/wpt/pull/63235
EWS
Comment 4
2026-10-04 22:47:46 PDT
Committed
322666@main
(814ebe2cfe6a): <
https://commits.webkit.org/322666@main
> Reviewed commits have been landed. Closing PR #75748 and removing active labels.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug