Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 67bc63c03450d4128c2a12d2f750776a020ae8bd
      
https://github.com/WebKit/WebKit/commit/67bc63c03450d4128c2a12d2f750776a020ae8bd
  Author: Tyler Wilcock <[email protected]>
  Date:   2026-07-22 (Wed, 22 Jul 2026)

  Changed paths:
    A LayoutTests/accessibility/label-for-control-id-change-expected.txt
    A LayoutTests/accessibility/label-for-control-id-change.html
    M Source/WebCore/accessibility/AXObjectCache.cpp

  Log Message:
  -----------
  REGRESSION(317690@main): A label-for relation is not re-resolved when the 
target control's id changes
https://bugs.webkit.org/show_bug.cgi?id=319990
rdar://182918982

Reviewed by Andres Gonzalez.

Relations are only re-resolved on an id-attribute change when the changed id is
referenced by a relation (AXObjectCache::idChangeCanAffectRelations, backed by
m_referencedRelationTargetIds). That set was populated only from relation 
attribute
values (relationAttributes()), which does not include the label `for` attribute.
NativeLabelFor/LabelFor relations are established separately in 
addLabelForRelation()
via HTMLLabelElement::control(). As a result, giving an element the id that an
existing label-for points at no longer associated the label with the control.

Record a label's `for` target id in addLabelForRelation() (resolved or not, and
before the not-in-tree-scope bail so the set stays a complete superset) so that 
an
id change to or from that id re-resolves the label's control relation.

* LayoutTests/accessibility/label-for-control-id-change-expected.txt: Added.
* LayoutTests/accessibility/label-for-control-id-change.html: Added.
* Source/WebCore/accessibility/AXObjectCache.cpp:
(WebCore::AXObjectCache::addLabelForRelation):

Canonical link: https://commits.webkit.org/317751@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to