Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: dc550e53da50f856a1a5e6102db067cf6bbd7f7c
https://github.com/WebKit/WebKit/commit/dc550e53da50f856a1a5e6102db067cf6bbd7f7c
Author: Ahmad Saleem <[email protected]>
Date: 2026-05-09 (Sat, 09 May 2026)
Changed paths:
M
LayoutTests/imported/w3c/web-platform-tests/svg-aam/name/comp_host_language_label-expected.txt
M Source/WebCore/accessibility/AccessibilityNodeObject.h
M Source/WebCore/accessibility/AccessibilitySVGObject.cpp
M Source/WebCore/accessibility/AccessibilitySVGObject.h
Log Message:
-----------
AX: Interactive elements containing the `<svg>` element which is named by
`<title>` element doesn't have accessible name
https://bugs.webkit.org/show_bug.cgi?id=309958
rdar://172559238
Reviewed by Tyler Wilcock.
This patch aligns WebKit with Gecko / Firefox and Blink / Chromium.
When an <a> or <button> wraps an <svg> whose name comes from a <title> child,
the host element's accessible name was empty. Other browsers (and the
svg-aam WPTs) expose the SVG's title as the interactive element's name.
WebKit derives the <a>/<button> accname via textUnderElement, which iterates
children and — for each AccessibilityNodeObject child — calls alternativeText()
to see if the child contributes a name alternative before falling back to its
inner text. AccessibilitySVGObject did not override alternativeText, so the
SVG's <title>/xlink:title/alt/use-target name (already computed by
AccessibilitySVGObject::description()) never reached the parent's name
computation. The <title> child itself is display:none and has no renderer,
so the textUnderElement fallback also produced nothing.
Fix it by overriding alternativeText in AccessibilitySVGObject to publish
description() as an AccessibilityTextSource::Alternative entry. This mirrors
what accessibilityText() already does for the SVG's own name, and lets host
elements pick up the SVG name via the existing descendant-traversal path.
To make the override possible, mark AccessibilityNodeObject::alternativeText
as virtual.
*
LayoutTests/imported/w3c/web-platform-tests/svg-aam/name/comp_host_language_label-expected.txt:
* Source/WebCore/accessibility/AccessibilityNodeObject.h:
* Source/WebCore/accessibility/AccessibilitySVGObject.cpp:
(WebCore::AccessibilitySVGObject::alternativeText const):
* Source/WebCore/accessibility/AccessibilitySVGObject.h:
Canonical link: https://commits.webkit.org/312953@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications