Bug 246135

Summary: AX: The isolated tree doesn't update in response to HTMLOptionElement::setSelectedState changes
Product: WebKit Reporter: Tyler Wilcock <tyler_w>
Component: AccessibilityAssignee: Tyler Wilcock <tyler_w>
Status: RESOLVED FIXED    
Severity: Normal CC: aboxhall, andresg_22, apinheiro, cdumez, cfleizach, changseok, dmazzoni, esprehn+autocc, ews-watchlist, gyuyoung.kim, jcraig, jdiggs, mifenton, samuel_white, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch none

Description Tyler Wilcock 2022-10-05 23:42:45 PDT
AX: The isolated tree doesn't update in response to HTMLOptionElement::setSelectedState changes
Comment 1 Radar WebKit Bug Importer 2022-10-05 23:42:56 PDT
<rdar://problem/100839849>
Comment 2 Tyler Wilcock 2022-10-05 23:52:12 PDT
Created attachment 462829 [details]
Patch
Comment 3 Andres Gonzalez 2022-10-06 07:14:28 PDT
(In reply to Tyler Wilcock from comment #2)
> Created attachment 462829 [details]
> Patch

--- a/Source/WebCore/accessibility/AXObjectCache.cpp
+++ a/Source/WebCore/accessibility/AXObjectCache.cpp

+bool isARIATableCell(Node* node)

Make it a static function like isSimpleImage.

--- a/Source/WebCore/accessibility/AXObjectCache.h
+++ a/Source/WebCore/accessibility/AXObjectCache.h

+    void selectedStateChanged(Node*);

Rename to onSelectedStateChange.

--- a/Source/WebCore/accessibility/ios/AXObjectCacheIOS.mm
+++ a/Source/WebCore/accessibility/ios/AXObjectCacheIOS.mm

-    if (notificationName.isNull())
+    if (notificationName.isNull() || (notificationName == SelectedCellsChangedNotificationName && !isARIATableCell(object->node())))
         return;

Why do we want to suppress this notification here? If we don't want an iOS client to react to it, we should ignore it closer to the client, maybe in the system bundle.

--- a/Source/WebCore/accessibility/mac/AXObjectCacheMac.mm
+++ a/Source/WebCore/accessibility/mac/AXObjectCacheMac.mm

     case AXSelectedStateChanged:
-        macNotification = NSAccessibilitySelectedCellsChangedNotification;
-        break;
+        if (isARIATableCell(object->node())) {
+            macNotification = NSAccessibilitySelectedCellsChangedNotification;
+            break;
+        }
+        return;

If we want to distinguish SelectedState from SelectedCells for table cells, we should add a new AXSelectedCellsChanged, so that we shouldn't need to call isARIATableCell(object->node()) here.
Comment 4 Tyler Wilcock 2022-10-06 11:59:34 PDT
Created attachment 462843 [details]
Patch
Comment 5 EWS 2022-10-07 10:44:38 PDT
Committed 255279@main (1aa25b42a5eb): <https://commits.webkit.org/255279@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 462843 [details].