Skip to content

fix(a11y): identify form validation errors for assistive technology (WCAG 3.3.1) - #46455

Open
sadpandajoe wants to merge 7 commits into
masterfrom
ultraset-wcag-error-identification-role-alert-aria-describedby
Open

sadpandajoe wants to merge 7 commits into
masterfrom
ultraset-wcag-error-identification-role-alert-aria-describedby

Conversation

@sadpandajoe

Copy link
Copy Markdown
Member

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:

  • ControlHeader shows explore control validationErrors only as an icon whose text lives in a hover tooltip, and NumberControl/TextControl set no aria-invalid/aria-describedby, so the error text is not in the DOM at all for screen readers.
  • ModalFormField renders 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 antd FormItem with noStyle (dashboard Properties > Name), antd also replaces the input's aria-describedby with the id of a help element it never renders once its rule fails.
  • LabeledErrorBoundInput and the SSH tunnel Private Key field wrap their inputs in un-named antd FormItems, so antd injects no aria-invalid/aria-describedby, and antd 6's error list has no live region. This affects every SSH tunnel and database connection field.
  • AlertReportModal has no inline error on the name and Editors fields; the only error text is the disabled Save button's tooltip. SubjectPicker also dropped any aria props passed to it.

Changes:

  • ControlHeader accepts an errorId and renders a single visually hidden role="alert" element with the error text; NumberControl and TextControl share that id through aria-describedby and set aria-invalid. One error element and one live region per control, no duplicate ids or duplicate visible text.
  • ModalFormField gives its error role="alert" and an id, and applies aria-invalid/aria-describedby to its input, including an input wrapped in FormItem. For a named FormItem, the input is rendered through a small forwardRef component 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.
  • LabeledErrorBoundInput renders the error help text with an id and role="alert" and references it from the text, password and textarea inputs. SSHTunnelForm already routes its sshErrors through this component; its Private Key textarea, which uses its own FormItem, gets the same id + role="alert" + aria-invalid/aria-describedby wiring. No new validation state.
  • AlertReportModal shows inline name and editors errors read from the General section's validation result, once the alert has loaded; SubjectPicker forwards aria-invalid/aria-describedby to its select.

Already satisfied on master and left unchanged: Alert and BasicErrorAlert already render role="alert", and the roles form's RoleNameField is a named antd FormItem with a required rule, which already sets aria-required, aria-invalid and aria-describedby.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

screenshots: none (ARIA-only change; the Alerts & Reports modal is not reachable in the preview)

TESTING INSTRUCTIONS

  1. Explore: open a chart that has a numeric or text control, enter an invalid value (e.g. letters in a numeric text field) and inspect the input: it has aria-invalid="true" and aria-describedby pointing at an element with role="alert" containing the error text. The control looks the same as before (error icon + tooltip).
  2. Alerts & Reports: open "+ Alert". The "Alert name" field shows "Alert name is required" with role="alert", and the name input references it via aria-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 gets aria-invalid="true" and aria-describedby pointing at it. Opening an existing valid alert shows no inline errors while it loads.
  3. Databases: open "+ Database", choose a database, enable SSH tunnel, focus and leave a required SSH field empty: the input gets aria-invalid="true" and aria-describedby pointing at the error text, which has role="alert". Switch "Login with" to "Private Key & Password", leave Private Key empty and blur it: the textarea gets the same attributes and the message has role="alert".
  4. Dashboard properties: type a character into Name, then clear it. The input has aria-invalid="true" and its aria-describedby points at the visible "Dashboard name is required" message, which has role="alert".
  5. With a screen reader (e.g. VoiceOver or NVDA), the errors above are announced when they appear, and focusing the invalid input reads its error.

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

Notes:

  • On a new alert, the inline name error is visible, and announced, as soon as the Alerts & Reports modal opens, because validation runs on mount.
  • ModalFormField's DescribedControl passes antd's injected props and ref to the input, so an input inside a FormItem that sets its own onChange, onBlur or ref would have those replaced; no current caller sets any.
  • ControlHeader renders the hidden alert region for every control with validation errors, but only NumberControl and TextControl link their input to it.
  • The screen-reader-only style in ControlHeader duplicates the existing blocks in FilterPopoverContent and SecureExtraHints.

🤖 Generated with Claude Code

sadpandajoe and others added 5 commits November 21, 2026 21:37
…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>
…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>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added the i18n Namespace | Anything related to localization label Nov 21, 2026
@codeant-ai-for-open-source

codeant-ai-for-open-source Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

CodeAnt  CodeAnt PR Risk

🟢  Low Risk

  • The PR appears safe to merge; no actionable issues were identified in the review.

Assessed commit: 60b15c7ce5fd

@codecov

codecov Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.21429% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 85.93%. Comparing base (04c4287) to head (60b15c7).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
...t-frontend/src/components/Modal/ModalFormField.tsx 95.00% 1 Missing ⚠️
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           
Flag Coverage Δ
hive 33.88% <ø> (ø)
javascript 82.76% <98.21%> (+0.01%) ⬆️
mysql 51.56% <ø> (-0.01%) ⬇️
postgres 51.59% <ø> (-0.01%) ⬇️
presto 35.56% <ø> (ø)
python 88.42% <ø> (ø)
sqlite 51.26% <ø> (ø)
unit 83.84% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

…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

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

i18n Namespace | Anything related to localization packages size/XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant