Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: dc3b7a297ecef964aaf7af889dfbacb452417bb0
      
https://github.com/WebKit/WebKit/commit/dc3b7a297ecef964aaf7af889dfbacb452417bb0
  Author: Alan Baradlay <[email protected]>
  Date:   2026-08-17 (Mon, 17 Aug 2026)

  Changed paths:
    A 
LayoutTests/imported/w3c/web-platform-tests/accname/name/comp_name_from_content_display_contents-expected.txt
    A 
LayoutTests/imported/w3c/web-platform-tests/accname/name/comp_name_from_content_display_contents.html
    M Source/WebCore/accessibility/AccessibilityObject.h

  Log Message:
  -----------
  Accessible name of a display: contents element includes text from its siblings
https://bugs.webkit.org/show_bug.cgi?id=321874

Reviewed by Antti Koivisto.

Name from contents walks the element's children by taking its first child and 
then repeatedly the next
sibling. A display: contents element has no box for its children to hang off, 
so the object after its last
child is one of the element's own siblings, and the walk carries on into it. 
The check meant to stop this only
did so when the next object had a display: contents parent of its own that 
differed, which the siblings do
not have, so nothing stopped it. Ask instead whether the next object is still a 
child of the element we
started from.

Chrome and Firefox name all of the cases in the test "x". Whether the leak was 
visible depended on what
followed in the markup, which is why the div at line 66 of
css/css-display/accessibility/display-contents-role-and-label.html reported "x 
x x x" while the same shape
with the link role a hundred lines later reported "x": the latter is followed 
by a display: contents list
whose item did trip the old check, and the two objects it had already walked 
into were whitespace only.

* Source/WebCore/accessibility/AccessibilityObject.h:
(WebCore::AccessibilityObject::iterator::ensureContentsParentValidity):
* 
LayoutTests/imported/w3c/web-platform-tests/accname/name/comp_name_from_content_display_contents.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/accname/name/comp_name_from_content_display_contents-expected.txt:
 Added.

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



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

Reply via email to