Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 5d643104e491bd71dc72eaaf0d52dbfdef918360
https://github.com/WebKit/WebKit/commit/5d643104e491bd71dc72eaaf0d52dbfdef918360
Author: Tyler Wilcock <[email protected]>
Date: 2026-10-03 (Sat, 03 Oct 2026)
Changed paths:
A
LayoutTests/accessibility/detected-form-error-activation-that-does-not-submit-expected.txt
A
LayoutTests/accessibility/detected-form-error-activation-that-does-not-submit.html
A
LayoutTests/accessibility/detected-form-error-button-in-form-without-submission-expected.txt
A
LayoutTests/accessibility/detected-form-error-button-in-form-without-submission.html
A LayoutTests/accessibility/detected-form-error-custom-dropdown-expected.txt
A LayoutTests/accessibility/detected-form-error-custom-dropdown.html
M
LayoutTests/accessibility/detected-form-error-distant-text-is-not-a-message-expected.txt
M
LayoutTests/accessibility/detected-form-error-distant-text-is-not-a-message.html
M
LayoutTests/accessibility/detected-form-error-long-text-is-not-a-message-expected.txt
M
LayoutTests/accessibility/detected-form-error-long-text-is-not-a-message.html
A
LayoutTests/accessibility/detected-form-error-messages-in-field-order-expected.txt
A LayoutTests/accessibility/detected-form-error-messages-in-field-order.html
A
LayoutTests/accessibility/detected-form-error-notification-when-submitter-replaced-expected.txt
A
LayoutTests/accessibility/detected-form-error-notification-when-submitter-replaced.html
A
LayoutTests/accessibility/detected-form-error-quantity-fields-are-not-a-form-expected.txt
A
LayoutTests/accessibility/detected-form-error-quantity-fields-are-not-a-form.html
A
LayoutTests/accessibility/detected-form-error-submit-button-click-prevented-expected.txt
A
LayoutTests/accessibility/detected-form-error-submit-button-click-prevented.html
A
LayoutTests/accessibility/detected-form-error-uncolored-message-after-possible-submission-expected.txt
A
LayoutTests/accessibility/detected-form-error-uncolored-message-after-possible-submission.html
A
LayoutTests/accessibility/detected-form-error-without-form-element-expected.txt
A
LayoutTests/accessibility/detected-form-error-without-form-element-in-components-expected.txt
A
LayoutTests/accessibility/detected-form-error-without-form-element-in-components.html
A LayoutTests/accessibility/detected-form-error-without-form-element.html
A
LayoutTests/accessibility/isolated-tree/detected-form-error-activation-that-does-not-submit-expected.txt
A
LayoutTests/accessibility/isolated-tree/detected-form-error-activation-that-does-not-submit.html
A
LayoutTests/accessibility/isolated-tree/detected-form-error-button-in-form-without-submission-expected.txt
A
LayoutTests/accessibility/isolated-tree/detected-form-error-button-in-form-without-submission.html
A
LayoutTests/accessibility/isolated-tree/detected-form-error-custom-dropdown-expected.txt
A
LayoutTests/accessibility/isolated-tree/detected-form-error-custom-dropdown.html
M
LayoutTests/accessibility/isolated-tree/detected-form-error-distant-text-is-not-a-message-expected.txt
M
LayoutTests/accessibility/isolated-tree/detected-form-error-distant-text-is-not-a-message.html
M
LayoutTests/accessibility/isolated-tree/detected-form-error-long-text-is-not-a-message-expected.txt
M
LayoutTests/accessibility/isolated-tree/detected-form-error-long-text-is-not-a-message.html
A
LayoutTests/accessibility/isolated-tree/detected-form-error-messages-in-field-order-expected.txt
A
LayoutTests/accessibility/isolated-tree/detected-form-error-messages-in-field-order.html
A
LayoutTests/accessibility/isolated-tree/detected-form-error-notification-when-submitter-replaced-expected.txt
A
LayoutTests/accessibility/isolated-tree/detected-form-error-notification-when-submitter-replaced.html
A
LayoutTests/accessibility/isolated-tree/detected-form-error-quantity-fields-are-not-a-form-expected.txt
A
LayoutTests/accessibility/isolated-tree/detected-form-error-quantity-fields-are-not-a-form.html
A
LayoutTests/accessibility/isolated-tree/detected-form-error-submit-button-click-prevented-expected.txt
A
LayoutTests/accessibility/isolated-tree/detected-form-error-submit-button-click-prevented.html
A
LayoutTests/accessibility/isolated-tree/detected-form-error-uncolored-message-after-possible-submission-expected.txt
A
LayoutTests/accessibility/isolated-tree/detected-form-error-uncolored-message-after-possible-submission.html
A
LayoutTests/accessibility/isolated-tree/detected-form-error-without-form-element-expected.txt
A
LayoutTests/accessibility/isolated-tree/detected-form-error-without-form-element-in-components-expected.txt
A
LayoutTests/accessibility/isolated-tree/detected-form-error-without-form-element-in-components.html
A
LayoutTests/accessibility/isolated-tree/detected-form-error-without-form-element.html
A
LayoutTests/accessibility/isolated-tree/mac/detected-form-error-click-that-does-not-submit-expected.txt
A
LayoutTests/accessibility/isolated-tree/mac/detected-form-error-click-that-does-not-submit.html
A
LayoutTests/accessibility/isolated-tree/mac/detected-form-error-key-press-that-does-not-submit-expected.txt
A
LayoutTests/accessibility/isolated-tree/mac/detected-form-error-key-press-that-does-not-submit.html
A
LayoutTests/accessibility/isolated-tree/mac/detected-form-error-key-press-without-form-element-expected.txt
A
LayoutTests/accessibility/isolated-tree/mac/detected-form-error-key-press-without-form-element.html
A
LayoutTests/accessibility/mac/detected-form-error-click-that-does-not-submit-expected.txt
A
LayoutTests/accessibility/mac/detected-form-error-click-that-does-not-submit.html
A
LayoutTests/accessibility/mac/detected-form-error-in-unexplored-form-expected.txt
A LayoutTests/accessibility/mac/detected-form-error-in-unexplored-form.html
A
LayoutTests/accessibility/mac/detected-form-error-key-press-that-does-not-submit-expected.txt
A
LayoutTests/accessibility/mac/detected-form-error-key-press-that-does-not-submit.html
A
LayoutTests/accessibility/mac/detected-form-error-key-press-without-form-element-expected.txt
A
LayoutTests/accessibility/mac/detected-form-error-key-press-without-form-element.html
M LayoutTests/platform/glib/TestExpectations
M LayoutTests/platform/ios/TestExpectations
M Source/WebCore/accessibility/AXFormActivityMonitor.cpp
M Source/WebCore/accessibility/AXFormActivityMonitor.h
M Source/WebCore/accessibility/AXObjectCache.cpp
M Source/WebCore/accessibility/AXObjectCache.h
M Source/WebCore/dom/EventDispatcher.cpp
M Source/WebCore/testing/Internals.cpp
M Source/WebCore/testing/Internals.h
M Source/WebCore/testing/Internals.idl
Log Message:
-----------
AX Error Detection: Errors go undetected when fields are validated outside of
an explicit form-element submission
https://bugs.webkit.org/show_bug.cgi?id=325671
rdar://188723977
Reviewed by Dominic Mazzoni.
Detection only started watching for error messages when a <form> was submitted,
but many pages never
submit one. Some have no <form> element at all, just fields in a <div> and a
"Continue" button or a
<div role="button"> with a click listener. Others check their fields from a
type="button" button, or call
preventDefault() on their submit button's click. On those pages VoiceOver never
announced the errors the
page wrote, and the fields never reported themselves as invalid.
Also start a watch from a trusted click or key press. EventDispatcher passes
these to the accessibility
cache, when the document has one, before any of the page's listeners run, since
those listeners are where
pages write their errors. As with the rest of detection, nothing happens unless
the
AccessibilityFormErrorDetectionEnabled setting is on. A click on or inside a
native button or
role="button" element counts, unless the button is disabled, resets its form,
has some other explicit
role, or toggles, selects, expands or opens something. So does Enter or Space
on such a button, and Enter
in a text field that isn't a search field and doesn't offer suggestions.
Controls the browser builds
inside a field, and key presses an input method took, never count.
The fields such a control acts on are its form's, or else those of the nearest
ancestor holding at least
two text fields, or one if the ancestor has role="form". For Enter in a field,
the ancestor must also hold
a button. Search boxes, number fields such as a cart's quantity boxes,
unrendered fields and fields of
another form aren't counted. The search never goes past <body>, and stops at
page regions such as nav,
main and dialog, so a search box in a page header is not taken for part of the
checkout below it.
A real submission, a form's own submit button and Enter in a form's field are
clear attempts to submit.
After anything else, a message must be rendered in an error color, from red to
orange, or else be
uncolored text directly under the field nearest to it, when that field was on
screen at the time and is
now empty or invalid. This keeps status text such as "We sent a code to your
phone" from being announced
as an error. When a page load cancels the watch, only a clear attempt to submit
also clears the errors
already found, so a button that starts a download doesn't wipe them.
Pairing messages with fields, clearing errors and posting the notification now
work with any container,
not only a form. Fields inside a component's shadow root count too. When the
page has replaced the
control that was pressed, the notification goes to the container, or else to
the first field with an
error. Another attempt on the same fields gives the running watch a fresh
window and keeps what it found,
and a weaker attempt elsewhere doesn't take over a watch that has already found
messages.
Add internals.isWatchingForAccessibilityFormErrors(), so tests can wait for a
watch to end rather than
sleep, and use it in two existing tests.
*
LayoutTests/accessibility/detected-form-error-activation-that-does-not-submit-expected.txt:
Added.
*
LayoutTests/accessibility/detected-form-error-activation-that-does-not-submit.html:
Added.
*
LayoutTests/accessibility/detected-form-error-button-in-form-without-submission-expected.txt:
Added.
*
LayoutTests/accessibility/detected-form-error-button-in-form-without-submission.html:
Added.
*
LayoutTests/accessibility/detected-form-error-distant-text-is-not-a-message-expected.txt:
*
LayoutTests/accessibility/detected-form-error-distant-text-is-not-a-message.html:
*
LayoutTests/accessibility/detected-form-error-long-text-is-not-a-message-expected.txt:
* LayoutTests/accessibility/detected-form-error-long-text-is-not-a-message.html:
*
LayoutTests/accessibility/detected-form-error-notification-when-submitter-replaced-expected.txt:
Added.
*
LayoutTests/accessibility/detected-form-error-notification-when-submitter-replaced.html:
Added.
*
LayoutTests/accessibility/detected-form-error-quantity-fields-are-not-a-form-expected.txt:
Added.
*
LayoutTests/accessibility/detected-form-error-quantity-fields-are-not-a-form.html:
Added.
*
LayoutTests/accessibility/detected-form-error-submit-button-click-prevented-expected.txt:
Added.
*
LayoutTests/accessibility/detected-form-error-submit-button-click-prevented.html:
Added.
*
LayoutTests/accessibility/detected-form-error-uncolored-message-after-possible-submission-expected.txt:
Added.
*
LayoutTests/accessibility/detected-form-error-uncolored-message-after-possible-submission.html:
Added.
*
LayoutTests/accessibility/detected-form-error-without-form-element-expected.txt:
Added.
*
LayoutTests/accessibility/detected-form-error-without-form-element-in-components-expected.txt:
Added.
*
LayoutTests/accessibility/detected-form-error-without-form-element-in-components.html:
Added.
* LayoutTests/accessibility/detected-form-error-without-form-element.html:
Added.
*
LayoutTests/accessibility/isolated-tree/detected-form-error-activation-that-does-not-submit-expected.txt:
Added.
*
LayoutTests/accessibility/isolated-tree/detected-form-error-activation-that-does-not-submit.html:
Added.
*
LayoutTests/accessibility/isolated-tree/detected-form-error-button-in-form-without-submission-expected.txt:
Added.
*
LayoutTests/accessibility/isolated-tree/detected-form-error-button-in-form-without-submission.html:
Added.
*
LayoutTests/accessibility/isolated-tree/detected-form-error-distant-text-is-not-a-message-expected.txt:
*
LayoutTests/accessibility/isolated-tree/detected-form-error-distant-text-is-not-a-message.html:
*
LayoutTests/accessibility/isolated-tree/detected-form-error-long-text-is-not-a-message-expected.txt:
*
LayoutTests/accessibility/isolated-tree/detected-form-error-long-text-is-not-a-message.html:
*
LayoutTests/accessibility/isolated-tree/detected-form-error-notification-when-submitter-replaced-expected.txt:
Added.
*
LayoutTests/accessibility/isolated-tree/detected-form-error-notification-when-submitter-replaced.html:
Added.
*
LayoutTests/accessibility/isolated-tree/detected-form-error-quantity-fields-are-not-a-form-expected.txt:
Added.
*
LayoutTests/accessibility/isolated-tree/detected-form-error-quantity-fields-are-not-a-form.html:
Added.
*
LayoutTests/accessibility/isolated-tree/detected-form-error-submit-button-click-prevented-expected.txt:
Added.
*
LayoutTests/accessibility/isolated-tree/detected-form-error-submit-button-click-prevented.html:
Added.
*
LayoutTests/accessibility/isolated-tree/detected-form-error-uncolored-message-after-possible-submission-expected.txt:
Added.
*
LayoutTests/accessibility/isolated-tree/detected-form-error-uncolored-message-after-possible-submission.html:
Added.
*
LayoutTests/accessibility/isolated-tree/detected-form-error-without-form-element-expected.txt:
Added.
*
LayoutTests/accessibility/isolated-tree/detected-form-error-without-form-element-in-components-expected.txt:
Added.
*
LayoutTests/accessibility/isolated-tree/detected-form-error-without-form-element-in-components.html:
Added.
*
LayoutTests/accessibility/isolated-tree/detected-form-error-without-form-element.html:
Added.
*
LayoutTests/accessibility/isolated-tree/mac/detected-form-error-click-that-does-not-submit-expected.txt:
Added.
*
LayoutTests/accessibility/isolated-tree/mac/detected-form-error-click-that-does-not-submit.html:
Added.
*
LayoutTests/accessibility/isolated-tree/mac/detected-form-error-key-press-that-does-not-submit-expected.txt:
Added.
*
LayoutTests/accessibility/isolated-tree/mac/detected-form-error-key-press-that-does-not-submit.html:
Added.
*
LayoutTests/accessibility/isolated-tree/mac/detected-form-error-key-press-without-form-element-expected.txt:
Added.
*
LayoutTests/accessibility/isolated-tree/mac/detected-form-error-key-press-without-form-element.html:
Added.
*
LayoutTests/accessibility/mac/detected-form-error-click-that-does-not-submit-expected.txt:
Added.
*
LayoutTests/accessibility/mac/detected-form-error-click-that-does-not-submit.html:
Added.
*
LayoutTests/accessibility/mac/detected-form-error-key-press-that-does-not-submit-expected.txt:
Added.
*
LayoutTests/accessibility/mac/detected-form-error-key-press-that-does-not-submit.html:
Added.
*
LayoutTests/accessibility/mac/detected-form-error-key-press-without-form-element-expected.txt:
Added.
*
LayoutTests/accessibility/mac/detected-form-error-key-press-without-form-element.html:
Added.
* LayoutTests/platform/glib/TestExpectations:
* LayoutTests/platform/ios/TestExpectations:
* Source/WebCore/accessibility/AXFormActivityMonitor.cpp:
(WebCore::isLeftNeedingAttention):
(WebCore::isDirectlyBelow):
(WebCore::AXFormActivityMonitor::didAttemptSubmissionWithoutNavigation):
(WebCore::AXFormActivityMonitor::captureFieldsOnScreen):
(WebCore::AXFormActivityMonitor::startWatchWindow):
(WebCore::AXFormActivityMonitor::didStartLoading):
(WebCore::AXFormActivityMonitor::cancel):
(WebCore::isErrorColor):
(WebCore::isRenderedInErrorColor):
(WebCore::AXFormActivityMonitor::collectErrorMessagesFrom):
(WebCore::AXFormActivityMonitor::settleTimerFired):
(WebCore::AXFormActivityMonitor::report):
* Source/WebCore/accessibility/AXFormActivityMonitor.h:
* Source/WebCore/accessibility/AXObjectCache.cpp:
(WebCore::AXObjectCache::isWatchingForFormErrors const):
(WebCore::opensOrTogglesSomething):
(WebCore::explicitRole):
(WebCore::isButtonThatMaySubmit):
(WebCore::isButtonThePageBuilt):
(WebCore::candidateForButton):
(WebCore::clickedControlThatMaySubmit):
(WebCore::isSearchField):
(WebCore::offersSuggestions):
(WebCore::keyedControlThatMaySubmit):
(WebCore::FormLikeContent::textFieldCount const):
(WebCore::FormLikeContent::hasButton const):
(WebCore::FormLikeContent::hasEnough const):
(WebCore::countsTowardFormLikeContainer):
(WebCore::FormLikeContent::add):
(WebCore::FormLikeContent::addSubtree):
(WebCore::isInSectioningContent):
(WebCore::isPageRegionBoundary):
(WebCore::fieldsContainerForControl):
(WebCore::AXObjectCache::onTrustedClickOrKeyDownWillDispatch):
(WebCore::AXObjectCache::fieldsForErrorPairing):
(WebCore::AXObjectCache::clearDetectedErrorsForContainer):
(WebCore::AXObjectCache::formFieldsForErrorPairing): Deleted.
(WebCore::AXObjectCache::clearDetectedErrorsForForm): Deleted.
* Source/WebCore/accessibility/AXObjectCache.h:
* Source/WebCore/dom/EventDispatcher.cpp:
(WebCore::EventDispatcher::dispatchEvent):
* Source/WebCore/testing/Internals.cpp:
(WebCore::Internals::isWatchingForAccessibilityFormErrors const):
* Source/WebCore/testing/Internals.h:
* Source/WebCore/testing/Internals.idl:
Canonical link: https://commits.webkit.org/322606@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications