Repository navigation
fix(a11y): WCAG 3.3.1 — add error identification with role=alert and aria-describedby - #39245
Aitema-gmbh wants to merge 5 commits into
Conversation
There was a problem hiding this comment.
Code Review Agent Run #f7d2d1
Actionable Suggestions - 2
-
superset-frontend/src/explore/components/controls/NumberControl/index.tsx - 1
- Invalid HTML id when name is undefined · Line 94-95
-
superset-frontend/src/explore/components/ControlHeader.tsx - 1
- Duplicate HTML IDs in Error Handling · Line 184-200
Additional Suggestions - 4
-
superset-frontend/src/features/databases/DatabaseModal/SSHTunnelForm.tsx - 1
-
Custom CSS in error display · Line 97-101The error messages use inline styles (color: 'red', fontSize: '12px'), which violates the guideline to avoid custom CSS and follow antd best practices. Consider wrapping the Input components in Form.Item with validateStatus='error' and help props to leverage antd's built-in error styling and accessibility features, removing the need for manual aria attributes and custom spans.
-
-
superset-frontend/src/features/databases/DatabaseModal/SqlAlchemyForm.tsx - 2
-
Custom inline style for error color · Line 73-73The error message div uses an inline style for color, which violates the guideline to avoid custom CSS and follow antd best practices. Consider using the emotion css prop with theme.colorError instead, matching the pattern used elsewhere in the component like the Button's css prop.
Code suggestion
diff --git a/superset-frontend/src/features/databases/DatabaseModal/SqlAlchemyForm.tsx b/superset-frontend/src/features/databases/DatabaseModal/SqlAlchemyForm.tsx index 1234567..abcdef0 100644 --- a/superset-frontend/src/features/databases/DatabaseModal/SqlAlchemyForm.tsx +++ b/superset-frontend/src/features/databases/DatabaseModal/SqlAlchemyForm.tsx @@ -72,7 +72,7 @@ {nameError && ( <div className="helper" id="database-name-error" role="alert" style={{ color: 'var(--ifm-color-danger, #e04f5f)' }}> {t('Display Name is required')} </div> )} + {nameError && ( + <div className="helper" id="database-name-error" role="alert" css={(theme: SupersetTheme) => `color: ${theme.colorError};`}> + {t('Display Name is required')} + </div> + )}
-
Custom inline style for error color · Line 103-103Similar to the name error, this URI error message uses an inline style for color. Replace with emotion css prop using theme.colorError to align with antd best practices and avoid custom CSS.
Code suggestion
diff --git a/superset-frontend/src/features/databases/DatabaseModal/SqlAlchemyForm.tsx b/superset-frontend/src/features/databases/DatabaseModal/SqlAlchemyForm.tsx index 1234567..abcdef0 100644 --- a/superset-frontend/src/features/databases/DatabaseModal/SqlAlchemyForm.tsx +++ b/superset-frontend/src/features/databases/DatabaseModal/SqlAlchemyForm.tsx @@ -102,7 +102,7 @@ {uriError && ( <div className="helper" id="sqlalchemy-uri-error" role="alert" style={{ color: 'var(--ifm-color-danger, #e04f5f)' }}> {t('SQLAlchemy URI is required')} </div> )} + {uriError && ( + <div className="helper" id="sqlalchemy-uri-error" role="alert" css={(theme: SupersetTheme) => `color: ${theme.colorError};`}> + {t('SQLAlchemy URI is required')} + </div> + )}
-
-
superset-frontend/src/features/roles/RoleFormItems.tsx - 1
-
Redundant aria-required attribute · Line 40-44The aria-required="true" attribute appears redundant here, since antd's FormItem with required: true automatically adds aria-required to the input for accessibility. This manual addition is inconsistent with other similar FormItem usages in the codebase (e.g., UserInfoModal.tsx, ApiKeyCreateModal.tsx), which rely on antd's automatic handling. Removing it aligns with existing patterns and avoids potential duplication.
-
Review Details
-
Files reviewed - 14 · Commit Range:
2256819..2256819- superset-frontend/packages/superset-core/src/components/Alert/Alert.test.tsx
- superset-frontend/packages/superset-core/src/components/Alert/index.tsx
- superset-frontend/packages/superset-ui-core/src/components/Form/LabeledErrorBoundInput.tsx
- superset-frontend/src/components/ErrorMessage/BasicErrorAlert.test.tsx
- superset-frontend/src/components/ErrorMessage/BasicErrorAlert.tsx
- superset-frontend/src/components/Modal/ModalFormField.tsx
- superset-frontend/src/explore/components/ControlHeader.tsx
- superset-frontend/src/explore/components/controls/NumberControl/index.tsx
- superset-frontend/src/explore/components/controls/TextControl/index.tsx
- superset-frontend/src/features/alerts/AlertReportModal.tsx
- superset-frontend/src/features/alerts/components/NumberInput.tsx
- superset-frontend/src/features/databases/DatabaseModal/SSHTunnelForm.tsx
- superset-frontend/src/features/databases/DatabaseModal/SqlAlchemyForm.tsx
- superset-frontend/src/features/roles/RoleFormItems.tsx
-
Files skipped - 0
-
Tools
- Whispers (Secret Scanner) - ✔︎ Successful
- Detect-secrets (Secret Scanner) - ✔︎ Successful
Bito Usage Guide
Commands
Type the following command in the pull request comment and save the comment.
-
/review- Manually triggers a full AI review. -
/pause- Pauses automatic reviews on this pull request. -
/resume- Resumes automatic reviews. -
/resolve- Marks all Bito-posted review comments as resolved. -
/abort- Cancels all in-progress reviews.
Refer to the documentation for additional commands.
Configuration
This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.
Documentation & Help
There was a problem hiding this comment.
Code Review Agent Run #20ee56
Actionable Suggestions - 1
-
superset-frontend/src/features/alerts/AlertReportModal.tsx - 1
- Validation Logic Inconsistency · Line 2123-2125
Review Details
-
Files reviewed - 2 · Commit Range:
2256819..3f2a60f- superset-frontend/src/explore/components/ControlHeader.tsx
- superset-frontend/src/features/alerts/AlertReportModal.tsx
-
Files skipped - 0
-
Tools
- Whispers (Secret Scanner) - ✔︎ Successful
- Detect-secrets (Secret Scanner) - ✔︎ Successful
Bito Usage Guide
Commands
Type the following command in the pull request comment and save the comment.
-
/review- Manually triggers a full AI review. -
/pause- Pauses automatic reviews on this pull request. -
/resume- Resumes automatic reviews. -
/resolve- Marks all Bito-posted review comments as resolved. -
/abort- Cancels all in-progress reviews.
Refer to the documentation for additional commands.
Configuration
This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.
Documentation & Help
… ModalFormField traversal Address Bito + CodeAnt review findings on PR apache#39245: ControlHeader / NumberControl / TextControl - ControlHeader accepts an external errorId so wrappers share one DOM id per control. Previously both ControlHeader and the input wrapper rendered id="${name}-error" + role="alert", producing duplicate ids and duplicate screen-reader announcements for the same validation error. - NumberControl now computes a stable input id via useId when name is missing, so id="undefined" never hits the DOM. - The visible inline red error below the input keeps the text but drops its id and role="alert" — the live-region inside ControlHeader is the single source of truth for assistive tech. ModalFormField - Injecting aria-invalid / aria-describedby on the first child missed FormItem-wrapped inputs, leaving the real interactive element unlinked to the error. The traversal now hops through a single-child wrapper to decorate the wrapped input. SSHTunnelForm - Required-field check treated whitespace-only input as valid, letting users bypass validation with a space. The check now trims before the emptiness test. Already addressed in prior commit 3f2a60f on this branch: - AlertReportModal name/owners error guards against currentAlert loading - ControlHeader useId fallback for missing name Not changed: - RoleNameField — Ant Design FormItem with rules={[{required:true}]} already sets aria-invalid on the input via FieldContext when validation fails; the explicit render-prop pattern the bot suggested would nest FormItems for no behavior gain.
|
Thanks @bito-code-review @codeant-ai-for-open-source — the duplicate-id / duplicate-
Already addressed by prior follow-up One finding not taken: CodeAnt suggested wrapping |
✅ Deploy Preview for superset-docs-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Code Review Agent Run #38f541
Actionable Suggestions - 1
-
superset-frontend/src/explore/components/controls/TextControl/index.tsx - 1
- Duplicate error display · Line 109-115
Review Details
-
Files reviewed - 5 · Commit Range:
3f2a60f..9d0f14c- superset-frontend/src/components/Modal/ModalFormField.tsx
- superset-frontend/src/explore/components/ControlHeader.tsx
- superset-frontend/src/explore/components/controls/NumberControl/index.tsx
- superset-frontend/src/explore/components/controls/TextControl/index.tsx
- superset-frontend/src/features/databases/DatabaseModal/SSHTunnelForm.tsx
-
Files skipped - 0
-
Tools
- Whispers (Secret Scanner) - ✔︎ Successful
- Detect-secrets (Secret Scanner) - ✔︎ Successful
Bito Usage Guide
Commands
Type the following command in the pull request comment and save the comment.
-
/review- Manually triggers a full AI review. -
/pause- Pauses automatic reviews on this pull request. -
/resume- Resumes automatic reviews. -
/resolve- Marks all Bito-posted review comments as resolved. -
/abort- Cancels all in-progress reviews.
Refer to the documentation for additional commands.
Configuration
This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.
Documentation & Help
|
Feel free to mark all of the comments that you've addressed as resolved if that's the case.It seems like there's a conflict that needs resolution on this PR, but otherwise I'm inclined to merge it once all of the bot feedback is dealt with. |
|
Hi @rusackas — thanks for the review and the merge signal. Addressing your note on bot feedback and resolving the conflict: Bot triage complete: codeant-ai-for-open-source (9 inline comments):
Rebase/conflict resolution will be done by @Aitema-gmbh locally. Will ping you once the next push lands. |
9d0f14c to
7938a0d
Compare
… ModalFormField traversal Address Bito + CodeAnt review findings on PR apache#39245: ControlHeader / NumberControl / TextControl - ControlHeader accepts an external errorId so wrappers share one DOM id per control. Previously both ControlHeader and the input wrapper rendered id="${name}-error" + role="alert", producing duplicate ids and duplicate screen-reader announcements for the same validation error. - NumberControl now computes a stable input id via useId when name is missing, so id="undefined" never hits the DOM. - The visible inline red error below the input keeps the text but drops its id and role="alert" — the live-region inside ControlHeader is the single source of truth for assistive tech. ModalFormField - Injecting aria-invalid / aria-describedby on the first child missed FormItem-wrapped inputs, leaving the real interactive element unlinked to the error. The traversal now hops through a single-child wrapper to decorate the wrapped input. SSHTunnelForm - Required-field check treated whitespace-only input as valid, letting users bypass validation with a space. The check now trims before the emptiness test. Already addressed in prior commit 3f2a60f on this branch: - AlertReportModal name/owners error guards against currentAlert loading - ControlHeader useId fallback for missing name Not changed: - RoleNameField — Ant Design FormItem with rules={[{required:true}]} already sets aria-invalid on the input via FieldContext when validation fails; the explicit render-prop pattern the bot suggested would nest FormItems for no behavior gain.
…ine error styles Addresses three remaining bot-review items on PR apache#39245: - AlertReportModal: validateGeneralSection now bails early when currentAlert is still null/undefined, mirroring the display-side `currentAlert &&` gate. Previously validation flagged required-field errors during the brief load window, disabling save without showing the error to the user. Validation reruns once setCurrentAlert initializes the form data. - NumberControl, TextControl, SSHTunnelForm: the inline error spans used hardcoded `style={{ color: 'red', fontSize: '12px' }}`. Replaced with a reusable `fieldErrorStyles` helper that pulls colorError, fontSizeSM, and sizeUnit from the SupersetTheme, so error appearance follows theme tokens in dark mode and on custom themes.
There was a problem hiding this comment.
Code Review Agent Run #0bd36a
Actionable Suggestions - 1
-
superset-frontend/src/features/databases/DatabaseModal/SSHTunnelForm.tsx - 1
- Inconsistent Error ID Naming · Line 103-170
Review Details
-
Files reviewed - 14 · Commit Range:
b3b0593..c822114- superset-frontend/packages/superset-core/src/components/Alert/Alert.test.tsx
- superset-frontend/packages/superset-core/src/components/Alert/index.tsx
- superset-frontend/packages/superset-ui-core/src/components/Form/LabeledErrorBoundInput.tsx
- superset-frontend/src/components/ErrorMessage/BasicErrorAlert.test.tsx
- superset-frontend/src/components/ErrorMessage/BasicErrorAlert.tsx
- superset-frontend/src/components/Modal/ModalFormField.tsx
- superset-frontend/src/explore/components/ControlHeader.tsx
- superset-frontend/src/explore/components/controls/NumberControl/index.tsx
- superset-frontend/src/explore/components/controls/TextControl/index.tsx
- superset-frontend/src/features/alerts/AlertReportModal.tsx
- superset-frontend/src/features/alerts/components/NumberInput.tsx
- superset-frontend/src/features/databases/DatabaseModal/SSHTunnelForm.tsx
- superset-frontend/src/features/databases/DatabaseModal/SqlAlchemyForm.tsx
- superset-frontend/src/features/roles/RoleFormItems.tsx
-
Files skipped - 0
-
Tools
- Whispers (Secret Scanner) - ✔︎ Successful
- Detect-secrets (Secret Scanner) - ✔︎ Successful
Bito Usage Guide
Commands
Type the following command in the pull request comment and save the comment.
-
/review- Manually triggers a full AI review. -
/pause- Pauses automatic reviews on this pull request. -
/resume- Resumes automatic reviews. -
/resolve- Marks all Bito-posted review comments as resolved. -
/abort- Cancels all in-progress reviews.
Refer to the documentation for additional commands.
Configuration
This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.
Documentation & Help
…a-invalid, and aria-describedby
… ModalFormField traversal Address Bito + CodeAnt review findings on PR apache#39245: ControlHeader / NumberControl / TextControl - ControlHeader accepts an external errorId so wrappers share one DOM id per control. Previously both ControlHeader and the input wrapper rendered id="${name}-error" + role="alert", producing duplicate ids and duplicate screen-reader announcements for the same validation error. - NumberControl now computes a stable input id via useId when name is missing, so id="undefined" never hits the DOM. - The visible inline red error below the input keeps the text but drops its id and role="alert" — the live-region inside ControlHeader is the single source of truth for assistive tech. ModalFormField - Injecting aria-invalid / aria-describedby on the first child missed FormItem-wrapped inputs, leaving the real interactive element unlinked to the error. The traversal now hops through a single-child wrapper to decorate the wrapped input. SSHTunnelForm - Required-field check treated whitespace-only input as valid, letting users bypass validation with a space. The check now trims before the emptiness test. Already addressed in prior commit 3f2a60f on this branch: - AlertReportModal name/owners error guards against currentAlert loading - ControlHeader useId fallback for missing name Not changed: - RoleNameField — Ant Design FormItem with rules={[{required:true}]} already sets aria-invalid on the input via FieldContext when validation fails; the explicit render-prop pattern the bot suggested would nest FormItems for no behavior gain.
…ine error styles Addresses three remaining bot-review items on PR apache#39245: - AlertReportModal: validateGeneralSection now bails early when currentAlert is still null/undefined, mirroring the display-side `currentAlert &&` gate. Previously validation flagged required-field errors during the brief load window, disabling save without showing the error to the user. Validation reruns once setCurrentAlert initializes the form data. - NumberControl, TextControl, SSHTunnelForm: the inline error spans used hardcoded `style={{ color: 'red', fontSize: '12px' }}`. Replaced with a reusable `fieldErrorStyles` helper that pulls colorError, fontSizeSM, and sizeUnit from the SupersetTheme, so error appearance follows theme tokens in dark mode and on custom themes.
…r error fields Two real bugs surfaced after rebasing onto master and re-running jest: - ModalFormField + LabeledErrorBoundInput both used `useId()` directly for aria-describedby. React's useId returns `:r1:` style values, which are invalid as CSS selectors / DOM id lookup targets — jest-dom's `toBeVisible()` (via nwsapi) threw `SyntaxError: not a valid selector`. Strip the colons so the id is a usable selector target everywhere. - ModalFormField wrapped children in `Children.map(...)` only when an error was present, falling back to the raw `children` reference otherwise. Toggling between the two shapes auto-keyed vs. unkeyed children, so React unmounted and remounted the underlying input on every error transition, dropping keyboard focus mid-typing (`userEvent.type` then crashed in `setSelectionRange` because the active element fell back to body). Always run through Children.map; conditionally inject the aria props inside `applyAria` so the tree shape stays stable across renders. Test impact: LabeledErrorBoundInput error-state test and AlertReportModal 'modal reopen resets local state' both go from failing to passing. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
c822114 to
b165e97
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #39245 +/- ##
==========================================
+ Coverage 64.14% 64.15% +0.01%
==========================================
Files 2590 2590
Lines 138033 138130 +97
Branches 32019 32086 +67
==========================================
+ Hits 88537 88617 +80
- Misses 47977 47994 +17
Partials 1519 1519
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:
|
Code Review Agent Run #c69f77Actionable Suggestions - 0Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
rusackas
left a comment
There was a problem hiding this comment.
I rebased this locally against current master (same caveat as my other comments today: I don't have push access to aitema-de's fork even with maintainer edits on, so I can't land this myself). Good news: once rebased, everything passes, 239 tests across the files this PR touches, oxlint clean, and all the earlier bot threads check out against the current diff: the errorId prop threading through ControlHeader/NumberControl/TextControl is real and consistent, the whitespace-only validation fix on SSHTunnelForm is there, and the AlertReportModal loading-state gating is correct.
Two things worth flagging from the rebase itself, not bugs in this PR, just drift it'll need to account for:
AlertReportModal's "Owners" field was renamed to "Editors" onmaster(SubjectPickerreplacing the oldAsyncSelect-based owners picker) sometime after this branch was cut. The error-identification wiring needs to move to the new field under the new name, same validation, justeditorsinstead ofowners.SSHTunnelFormgrew its ownsshErrors/getValidation()mechanism onmaster, which already gets fullaria-invalid/aria-describedby/role="alert"wiring for free throughLabeledErrorBoundInput(confirmed by reading that component: it computeserrorDescriptionIdfromerrorMessageand renders the alert span itself). Theblurred/fieldErrorstate this PR adds in parallel is redundant once that's accounted for, I'd drop it here rather than carry two validation paths.
oxfmt also wants to reformat 4 files (Alert.test.tsx, NumberControl/index.tsx, SqlAlchemyForm.tsx, RoleFormItems.tsx), a plain pre-commit run after rebasing should catch that.
@Aitema-gmbh, once that's sorted this should be in good shape.
|
Superseded by #46455, which carries this fix forward. Thanks for the original work, @Aitema-gmbh! This PR can be closed. |
|
Thanks @sadpandajoe for carrying this forward in #46455, and thanks @rusackas for the reviews along the way. Closing in favour of #46455. |
SUMMARY
Implements WCAG 2.1 criterion 3.3.1 (Error Identification, Level A).
role="alert"to error containers (BasicErrorAlert, Alert component)aria-invalidandaria-describedbyto form inputs with validation errorsTESTING INSTRUCTIONS
role="alert"aria-invalid="true"andaria-describedbypointing to errorADDITIONAL INFORMATION
Part of a series of 16 individual WCAG 2.1 accessibility PRs. See also fix(a11y): Accessibility improvements for WCAG 2.1 Level A compliance #38342.