Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: f96d5091cd43ec126efe38ef45d06f3982274458
      
https://github.com/WebKit/WebKit/commit/f96d5091cd43ec126efe38ef45d06f3982274458
  Author: Joshua Hoffman <josh_hoff...@apple.com>
  Date:   2025-09-16 (Tue, 16 Sep 2025)

  Changed paths:
    A LayoutTests/accessibility/label-for-with-aria-labelledby-expected.txt
    A LayoutTests/accessibility/label-for-with-aria-labelledby.html
    A 
LayoutTests/platform/glib/accessibility/label-for-with-aria-labelledby-expected.txt
    M Source/WebCore/accessibility/AXObjectCache.cpp
    M Source/WebCore/accessibility/AXObjectCache.h

  Log Message:
  -----------
  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



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

Reply via email to