Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 2387eef3bad24a2fea2ba5f9943e38d446a07983
https://github.com/WebKit/WebKit/commit/2387eef3bad24a2fea2ba5f9943e38d446a07983
Author: Tyler Wilcock <[email protected]>
Date: 2026-06-12 (Fri, 12 Jun 2026)
Changed paths:
A LayoutTests/accessibility/anchor-with-click-handler-is-link-expected.txt
A LayoutTests/accessibility/anchor-with-click-handler-is-link.html
M Source/WebCore/accessibility/AXObjectCache.cpp
M Source/WebCore/accessibility/AXObjectCache.h
M Source/WebCore/accessibility/AccessibilityNodeObject.cpp
Log Message:
-----------
AX: An anchor element that has a click handler but no href should still be
considered a link
https://bugs.webkit.org/show_bug.cgi?id=316929
rdar://179398579
Reviewed by Chris Fleizach.
As a markup repair, Chrome and Firefox expose an <a> with a click handler but
no href as a link. WebKit did not: Element::isLink() is only true for anchors
with an href, so a hrefless anchor with an onclick handler fell through role
determination to the generic Inline role and was ignored by the accessibility
tree.
With this commit, we implement this markup repair.
* LayoutTests/accessibility/anchor-with-click-handler-is-link-expected.txt:
Added.
* LayoutTests/accessibility/anchor-with-click-handler-is-link.html: Added.
* Source/WebCore/accessibility/AXObjectCache.cpp:
(WebCore::isClickEvent):
(WebCore::AXObjectCache::onEventListenerAdded):
(WebCore::AXObjectCache::onEventListenerRemoved):
(WebCore::AXObjectCache::handleClickHandlerChanged):
(WebCore::AXObjectCache::handleAttributeChange):
* Source/WebCore/accessibility/AXObjectCache.h:
* Source/WebCore/accessibility/AccessibilityNodeObject.cpp:
(WebCore::AccessibilityNodeObject::determineAccessibilityRoleFromNode const):
Canonical link: https://commits.webkit.org/315102@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications