Repository navigation
fix(a11y): identify form validation errors for assistive technology (WCAG 3.3.1) - #46455
Open
sadpandajoe wants to merge 7 commits into
Open
sadpandajoe wants to merge 7 commits into
sadpandajoe wants to merge 7 commits into
Conversation
…WCAG 3.3.1) Validation errors in several shared form components were not exposed to assistive technology: - ControlHeader showed explore control errors only as an icon with a hover tooltip, and NumberControl/TextControl did not mark their input invalid. ControlHeader now renders one visually hidden role="alert" element whose id the control shares through a new errorId prop, and the controls set aria-invalid and aria-describedby on the input. - ModalFormField rendered the error text with no id or role. It now gives the error role="alert" and an id, and applies aria-invalid and aria-describedby to its input, including inputs wrapped in FormItem. - LabeledErrorBoundInput uses an unnamed FormItem, so antd added no association. The error help text now has an id and role="alert", and the input, password and textarea variants reference it. - AlertReportModal showed name and editors errors only in the Save button tooltip. Both fields now show an inline error derived from the General section validation result once the alert is loaded, and SubjectPicker forwards aria-invalid/aria-describedby to its select. Co-authored-by: Fedo Hagge-Kubat <office@aitema.org> Co-authored-by: Kolja <kolja@aitema.de> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…-identification-role-alert-aria-describedby
…n the SSH private key - ModalFormField: a named FormItem replaces its child's aria-describedby with the id of its own help element, which noStyle never renders, so the dashboard name input pointed at a missing element once its rule failed. The wrapped control is rendered through a small forwardRef component that receives the FormItem props and re-applies the field error id. - SSHTunnelForm: the private key textarea uses an unnamed FormItem, so its error was not associated. The help text now has an id and role="alert", and the textarea sets aria-invalid and aria-describedby. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…-identification-role-alert-aria-describedby
…-identification-role-alert-aria-describedby
1 task done
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Contributor
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #46455 +/- ##
=======================================
Coverage 85.92% 85.93%
=======================================
Files 3122 3122
Lines 216878 216930 +52
Branches 51422 51458 +36
=======================================
+ Hits 186360 186415 +55
+ Misses 27099 27096 -3
Partials 3419 3419
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…f any alert Validation errors now render as role=alert, so the blanket alert query also matched the screen-reader-only validation message. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
SUMMARY
Supersedes #39245.
Implements WCAG 2.1 success criterion 3.3.1 (Error Identification, Level A) for the shared form components where validation errors were not exposed to assistive technology. No specific introducing change identified; these gaps are long-standing.
Root cause, per component:
ControlHeadershows explore controlvalidationErrorsonly as an icon whose text lives in a hover tooltip, andNumberControl/TextControlset noaria-invalid/aria-describedby, so the error text is not in the DOM at all for screen readers.ModalFormFieldrenders the error as a plain<div className="error">with no id or role, and nothing associates it with the field. When the input is wrapped in a named antdFormItemwithnoStyle(dashboard Properties > Name), antd also replaces the input'saria-describedbywith the id of a help element it never renders once its rule fails.LabeledErrorBoundInputand the SSH tunnel Private Key field wrap their inputs in un-named antdFormItems, so antd injects noaria-invalid/aria-describedby, and antd 6's error list has no live region. This affects every SSH tunnel and database connection field.AlertReportModalhas no inline error on the name and Editors fields; the only error text is the disabled Save button's tooltip.SubjectPickeralso dropped any aria props passed to it.Changes:
ControlHeaderaccepts anerrorIdand renders a single visually hiddenrole="alert"element with the error text;NumberControlandTextControlshare that id througharia-describedbyand setaria-invalid. One error element and one live region per control, no duplicate ids or duplicate visible text.ModalFormFieldgives its errorrole="alert"and an id, and appliesaria-invalid/aria-describedbyto its input, including an input wrapped inFormItem. For a namedFormItem, the input is rendered through a smallforwardRefcomponent that receives the FormItem's props and re-applies the field error id, so the association survives antd's own rule validation. The child list keeps its shape so the input is not remounted when the error toggles.LabeledErrorBoundInputrenders the error help text with an id androle="alert"and references it from the text, password and textarea inputs.SSHTunnelFormalready routes itssshErrorsthrough this component; its Private Key textarea, which uses its ownFormItem, gets the same id +role="alert"+aria-invalid/aria-describedbywiring. No new validation state.AlertReportModalshows inline name and editors errors read from the General section's validation result, once the alert has loaded;SubjectPickerforwardsaria-invalid/aria-describedbyto its select.Already satisfied on master and left unchanged:
AlertandBasicErrorAlertalready renderrole="alert", and the roles form'sRoleNameFieldis a named antdFormItemwith a required rule, which already setsaria-required,aria-invalidandaria-describedby.BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
screenshots: none (ARIA-only change; the Alerts & Reports modal is not reachable in the preview)
TESTING INSTRUCTIONS
aria-invalid="true"andaria-describedbypointing at an element withrole="alert"containing the error text. The control looks the same as before (error icon + tooltip).role="alert", and the name input references it viaaria-describedby. Type a name and the error disappears. Edit an existing alert and remove all editors: "At least one editor is required" appears and the Editors combobox getsaria-invalid="true"andaria-describedbypointing at it. Opening an existing valid alert shows no inline errors while it loads.aria-invalid="true"andaria-describedbypointing at the error text, which hasrole="alert". Switch "Login with" to "Private Key & Password", leave Private Key empty and blur it: the textarea gets the same attributes and the message hasrole="alert".aria-invalid="true"and itsaria-describedbypoints at the visible "Dashboard name is required" message, which hasrole="alert".ADDITIONAL INFORMATION
Notes:
ModalFormField'sDescribedControlpasses antd's injected props and ref to the input, so an input inside aFormItemthat sets its ownonChange,onBlurorrefwould have those replaced; no current caller sets any.ControlHeaderrenders the hidden alert region for every control with validation errors, but onlyNumberControlandTextControllink their input to it.ControlHeaderduplicates the existing blocks inFilterPopoverContentandSecureExtraHints.🤖 Generated with Claude Code