Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 948e04657c156a2db5ecc272ec761e0add6b19e4
      
https://github.com/WebKit/WebKit/commit/948e04657c156a2db5ecc272ec761e0add6b19e4
  Author: Tyler Wilcock <[email protected]>
  Date:   2026-09-30 (Wed, 30 Sep 2026)

  Changed paths:
    A 
LayoutTests/accessibility/detected-form-error-message-in-shadow-root-expected.txt
    A LayoutTests/accessibility/detected-form-error-message-in-shadow-root.html
    A 
LayoutTests/accessibility/isolated-tree/detected-form-error-message-in-shadow-root-expected.txt
    A 
LayoutTests/accessibility/isolated-tree/detected-form-error-message-in-shadow-root.html
    M LayoutTests/platform/glib/TestExpectations
    M LayoutTests/platform/ios/TestExpectations
    M Source/WebCore/accessibility/AXFormActivityMonitor.cpp
    M Source/WebCore/accessibility/AXObjectCache.cpp

  Log Message:
  -----------
  AX Error Detection: A field doesn't report an error message rendered from a 
component's shadow root
https://bugs.webkit.org/show_bug.cgi?id=325714
rdar://188759731

Reviewed by Dominic Mazzoni.

Sites often build their error messages as web components that render the 
message from a shadow root.
Detection looked for such messages in the page's own DOM only, and got them 
wrong in three ways.

- When the component itself was recorded as the message, messageIsEmpty() found 
no text in its light DOM
  and treated the message as empty from the moment it was paired. The message 
was announced, but the field
  never reported invalid, had no error message, and wasn't counted in 
AXFormValidationErrorFieldCount.
- A component that writes its message as text directly inside its shadow root, 
as a Lit template holding
  only the message does, was never seen at all, because that text has no parent 
element to record.
- A component and parts of its own shadow content could be kept as separate 
messages, because the check
  that keeps only the outermost message used Node::contains, which stops at 
shadow boundaries. A component
  that puts a label such as "Error:" in front of the message could end up with 
just the label as the
  field's message.

Fix this by walking the composed tree in messageIsEmpty(), leaving out text the 
browser renders inside its
own controls, by recording the shadow host for text sitting directly in a 
shadow root, and by comparing
candidate messages with shadow-including containment. Also, when an element 
arrives whole after text inside
it arrived on its own, keep the fuller text, so a message is announced with its 
label. That applies to
light DOM messages too.

* 
LayoutTests/accessibility/detected-form-error-message-in-shadow-root-expected.txt:
 Added.
* LayoutTests/accessibility/detected-form-error-message-in-shadow-root.html: 
Added.
* 
LayoutTests/accessibility/isolated-tree/detected-form-error-message-in-shadow-root-expected.txt:
 Added.
* 
LayoutTests/accessibility/isolated-tree/detected-form-error-message-in-shadow-root.html:
 Added.
* LayoutTests/platform/glib/TestExpectations:
* LayoutTests/platform/ios/TestExpectations:
* Source/WebCore/accessibility/AXFormActivityMonitor.cpp:
(WebCore::AXFormActivityMonitor::onChangedContent):
(WebCore::AXFormActivityMonitor::collectErrorMessagesFrom):
* Source/WebCore/accessibility/AXObjectCache.cpp:
(WebCore::messageIsEmpty):

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



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

Reply via email to