Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 647c7baec5c5ad8ab1975a626d861cfb7769e89a
      
https://github.com/WebKit/WebKit/commit/647c7baec5c5ad8ab1975a626d861cfb7769e89a
  Author: Tyler Wilcock <[email protected]>
  Date:   2026-07-10 (Fri, 10 Jul 2026)

  Changed paths:
    A 
LayoutTests/accessibility/aria-labelledby-target-added-via-innerHTML-expected.txt
    A LayoutTests/accessibility/aria-labelledby-target-added-via-innerHTML.html
    M Source/WebCore/accessibility/AXObjectCache.cpp
    M Source/WebCore/accessibility/AXObjectCache.h

  Log Message:
  -----------
  AX: aria-labelledby relation isn't built when its target element is inserted 
via innerHTML
https://bugs.webkit.org/show_bug.cgi?id=317108
rdar://179677418

Reviewed by Dominic Mazzoni.

After the initial relations build, AXObjectCache resolves relations lazily and 
only
re-resolves when something dirties m_relationsNeedUpdate. When a relation 
source (e.g. a
<button aria-labelledby="label">) already exists but its target is inserted via 
innerHTML
afterwards, nothing dirties relations, so the source's aria-labelledby never 
resolves.

Fix this by remembering the ids referenced by a relation attribute whose target 
didn't exist
when relations were last built (m_unresolvedRelationTargetIds). When an element 
with one of
those ids is later inserted, dirty relations so they re-resolve. This is scoped 
to
previously-unresolved targets rather than every id-bearing element so that 
fully-resolvable
pages don't needlessly trigger the incremental rebuild (which iterates a 
WeakHashSet in
nondeterministic order and can reorder symmetric reverse-relations).

* 
LayoutTests/accessibility/aria-labelledby-target-added-via-innerHTML-expected.txt:
 Added.
* LayoutTests/accessibility/aria-labelledby-target-added-via-innerHTML.html: 
Added.
* Source/WebCore/accessibility/AXObjectCache.cpp:
(WebCore::AXObjectCache::performDeferredCacheUpdate):
(WebCore::AXObjectCache::updateRelationsIfNeeded):
(WebCore::AXObjectCache::addRelation):
* Source/WebCore/accessibility/AXObjectCache.h:

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



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

Reply via email to