Branch: refs/heads/main Home: https://github.com/WebKit/WebKit Commit: 3ebfc2b3a2576dff38122413858c423034309fbb https://github.com/WebKit/WebKit/commit/3ebfc2b3a2576dff38122413858c423034309fbb Author: Tyler Wilcock <tyle...@apple.com> Date: 2025-04-21 (Mon, 21 Apr 2025)
Changed paths: A LayoutTests/accessibility/mac/orphaned-text-in-button-expected.txt A LayoutTests/accessibility/mac/orphaned-text-in-button.html M Source/WebCore/accessibility/AccessibilityListBoxOption.h M Source/WebCore/accessibility/AccessibilityNodeObject.cpp M Source/WebCore/accessibility/AccessibilityRenderObject.cpp Log Message: ----------- AX: After ENABLE(INCLUDE_IGNORED_IN_CORE_AX_TREE), descendants of !canHaveChildren() objects can become orphaned, causing various incorrect AT behaviors https://bugs.webkit.org/show_bug.cgi?id=291762 rdar://149563180 Reviewed by Joshua Hoffman. After ENABLE(INCLUDE_IGNORED_IN_CORE_AX_TREE), each object in the isolated tree should have the same parentObject() as its main-thread equivalent. We did do this correctly, at least as far as storing the right AXIsolatedObject::m_parentID. However, the isolated tree is a copy of the main-thread tree, and Accessibility{Node,Render}Object::addChildren() exited early for any object that !canHaveChildren(). This meant that when we created the isolated tree, we never create isolated objects for these descendants, and thus when we go to look up the object stored in a descendants m_parentID, we fail to get anything. Orphaned objects (those who return nil for NSAccessibilityParentAttribute) cause VoiceOver to fail to create its own internal element for that object, in turn causing lots of wrong behaviors. The issue that motivated this was navigating by character inside a button's text, and no bounding box was being drawn. Fix this by allowing !canHaveChildren() objects to insert children. We already consider descendants of !canHaveChildren objects to be ignored, so inserting children for !canHaveChildren objects allows us to have a full and complete accessibility tree while maintaining the correct AT-facing behavior (because we ignore these descendants). This change exposed one existing bug that caused this: ASSERT(isTableComponent(child) || isTableComponent(*this) || child.parentObject() == this); to fire in AccessibilityObject::insertChild. This was caught by imported/w3c/web-platform-tests/accname/name/comp_name_from_content.html only because this test happened to use ::before on a button element, which now adds children. But this issue has been around ever since https://github.com/WebKit/WebKit/commit/6a44b38c10d068df677abf94c3f1d96e75fefb7a landed, as that changed AccessibilityRenderObject::addChildren to add ::before and ::after as children without making the analagous change to AccessibilityRenderObject::parentObject to force ::before and ::after to consider their generating element to be their parent. This same ASSERT was hit for AccessibilityListBoxOption, which have an unusal DOM structure. Fix this by overriding addChildren for this subclass to do nothing, matching the behavior before this commit and preventing the ASSERT. * LayoutTests/accessibility/mac/orphaned-text-in-button-expected.txt: Added. * LayoutTests/accessibility/mac/orphaned-text-in-button.html: Added. * Source/WebCore/accessibility/AccessibilityListBoxOption.h: * Source/WebCore/accessibility/AccessibilityNodeObject.cpp: (WebCore::AccessibilityNodeObject::addChildren): * Source/WebCore/accessibility/AccessibilityRenderObject.cpp: (WebCore::AccessibilityRenderObject::parentObject const): (WebCore::AccessibilityRenderObject::addChildren): Canonical link: https://commits.webkit.org/293929@main To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications _______________________________________________ webkit-changes mailing list webkit-changes@lists.webkit.org https://lists.webkit.org/mailman/listinfo/webkit-changes