You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
AX: <label>s that are targets of aria-labelledby lose their labelfor relationship when they change
https://bugs.webkit.org/show_bug.cgi?id=298891
rdar://158906980
Reviewed by Tyler Wilcock.
When <label> elements change, the handleLabelChanged method of AXObjectCache get's called to update
its labelfor relationships. In this code path, we clear all LabelFor relationships and re-add them
based on the label's `for` attribute. This is fine when a control's label just uses the `for` attribute,
but if the control itself uses aria-labelledby to point to the label element, we end up clearing this
relationship. This causes us a control's label to be stale, for example, because a text change on a label
won't know what other elements to update.
Fix this by preventing clearing LabelFor relationships when the control uses aria-label or aria-labelledby.
Test: accessibility/label-for-with-aria-labelledby.html
Test: accessibility/label-for-with-aria-labelledby.html
* LayoutTests/accessibility/label-for-with-aria-labelledby-expected.txt: Added.
* LayoutTests/accessibility/label-for-with-aria-labelledby.html: Added.
* LayoutTests/platform/glib/accessibility/label-for-with-aria-labelledby-expected.txt: Added.
* Source/WebCore/accessibility/AXObjectCache.cpp:
(WebCore::AXObjectCache::handleAttributeChange):
(WebCore::hasAnyARIALabelling):
(WebCore::AXObjectCache::handleLabelChanged):
(WebCore::AXObjectCache::updateLabelFor):
(WebCore::AXObjectCache::addRelation):
* Source/WebCore/accessibility/AXObjectCache.h:
Canonical link: https://commits.webkit.org/300029@main
0 commit comments