NEW327541
AX: [ATSPI] The popup of a native dropdown box does not expose its optgroups
https://bugs.webkit.org/show_bug.cgi?id=327541
Summary AX: [ATSPI] The popup of a native dropdown box does not expose its optgroups
Anne van Kesteren
Reported 2026-10-14 08:53:08 PDT
Created attachment 481803 [details] AI patch <select> <option>None</option> <optgroup label="Fruit"> <option>Apple</option> <option selected>Banana</option> </optgroup> <optgroup label="Vegetables" disabled> <option>Carrot</option> </optgroup> </select> With ATSPI, the popup (menu) of this select has four menu items: None, Apple, Banana, and Carrot. The optgroups are missing, and Carrot is reported as enabled. The native GTK popup (WebPopupMenuProxyGtk) shows the label of an optgroup as a row that cannot be selected, with the options of the group under it, and disables the options of a disabled optgroup. WPE gives applications the same structure through WebKitOptionMenuItem (is_group_label, is_group_child). Native list boxes, and base appearance pickers since 323412@main, expose an optgroup as a disabled item with its label, before its options and as their sibling. Causes: - AXObjectCache::getOrCreateSlow() creates no object for an optgroup of a native dropdown box, as that branch returns early without an option element. So AccessibilityMenuListPopup::addChildren() skips optgroups. - AccessibilityMenuListOption::isEnabled() only checks HTMLOptionElement::ownElementDisabled(), rather than isDisabledFormControl(), which includes a disabled optgroup. A fix also has to change AccessibilityMenuListPopup::didUpdateActiveOption(). It uses the option index it gets as an index into the children of the popup, which only works while those are options alone; it could look the option up with HTMLSelectElement::item() instead. Only ATSPI is affected. Mac ignores menu list popups and their options (AccessibilityObject::accessibilityPlatformIncludesObject()), as VoiceOver reads the NSMenu that the UI process builds. iOS doesn't make them accessibility elements. A draft patch is attached. It creates an AccessibilityMenuListOption for an optgroup too, with groupLabelText() as its value, disabled and not selectable. It changes isEnabled() and didUpdateActiveOption() as above, and adds accessibility/gtk/menu-list-popup-optgroups.html. It compiles on Mac, but has not been built or run on GTK or WPE.
Attachments
AI patch (9.86 KB, patch)
2026-10-14 08:53 PDT, Anne van Kesteren
no flags
Radar WebKit Bug Importer
Comment 1 2026-10-14 08:53:17 PDT
Note You need to log in before you can comment on or make changes to this bug.