Title: [294552] trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm
Revision
294552
Author
[email protected]
Date
2022-05-20 10:13:32 -0700 (Fri, 20 May 2022)

Log Message

WebAccessibilityObjectWrapperMac::detachIsolatedObject should not unregister the wrapper for AccessibilityDetachmentType::ElementChanged detachments
https://bugs.webkit.org/show_bug.cgi?id=240628

Reviewed by Chris Fleizach.

Prior to this change, WebAccessibilityObjectWrapperMac::detachIsolatedObject unconditionally
called NSAccessibilityUnregisterUniqueIdForUIElement. This is the wrong
behavior for AccessibilityDetachmentType::ElementChanged detachments, as
this unregistering causes an element destroyed notification to be issued.

This type of detachment happens when we swap the underlying isolated
object for a wrapper as the result of a call to AXIsolatedTree::updateNode.

This unregistering caused VoiceOver focus flickering when modifying
sliders or textboxes, greatly hampering user experience.

No test included because there isn't a great way to test this.

* Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
(-[WebAccessibilityObjectWrapper detachIsolatedObject:]):

Canonical link: https://commits.webkit.org/250805@main

Modified Paths

Diff

Modified: trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm (294551 => 294552)


--- trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm	2022-05-20 17:09:55 UTC (rev 294551)
+++ trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm	2022-05-20 17:13:32 UTC (rev 294552)
@@ -542,7 +542,10 @@
 #if ENABLE(ACCESSIBILITY_ISOLATED_TREE)
 - (void)detachIsolatedObject:(AccessibilityDetachmentType)detachmentType
 {
-    NSAccessibilityUnregisterUniqueIdForUIElement(self);
+    // Only unregister this wrapper if the underlying object or cache is being destroyed. Unregistering it in other cases (like `ElementChanged`)
+    // would cause AX clients to get a notification that this wrapper was destroyed, which wouldn't be true.
+    if (detachmentType == AccessibilityDetachmentType::ElementDestroyed || detachmentType == AccessibilityDetachmentType::CacheDestroyed)
+        NSAccessibilityUnregisterUniqueIdForUIElement(self);
     [super detachIsolatedObject:detachmentType];
 }
 #endif
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to