-
Notifications
You must be signed in to change notification settings - Fork 24
Issue/1745 #1749
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Issue/1745 #1749
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR enhances accessibility by wrapping feedback messages in an AccessibleFeedback component that uses ARIA live regions to announce validation messages to screen reader users.
Key Changes:
- Introduces a new
AccessibleFeedbackcomponent withrole="alert"andaria-live="assertive" - Wraps all feedback/helper text throughout form field components with this new component
- Adds
aria-describedbyattributes linking form controls to their feedback messages - Renames
StyledRequiredTypographytoStyledFeedbackTypographyfor clarity
Reviewed Changes
Copilot reviewed 19 out of 19 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| AccessibleFeedback.tsx | New component that wraps feedback in ARIA live region for screen reader announcements |
| Item.styles.ts | Renames styled component from StyledRequiredTypography to StyledFeedbackTypography |
| TextField.tsx, StringField.tsx, UrlField.tsx, IntegerField.tsx, DecimalField.tsx, QuantityField.tsx, CustomDateField.tsx | Wraps helperText prop with AccessibleFeedback component |
| SliderField.tsx, RadioFormGroup.tsx, CheckboxFormGroup.tsx, BooleanField.tsx, AttachmentField.tsx | Adds feedbackId, aria-describedby attribute, and wraps feedback with AccessibleFeedback |
| OpenChoice*.tsx, ChoiceSelect*.tsx | Migrates feedback from separate Typography element to helperText prop wrapped in AccessibleFeedback |
| CustomTimeField.tsx | Wraps existing Typography feedback element with AccessibleFeedback component |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
packages/smart-forms-renderer/src/components/FormComponents/ItemParts/RadioFormGroup.tsx
Outdated
Show resolved
Hide resolved
...orms-renderer/src/components/FormComponents/ChoiceItems/ChoiceSelectAnswerValueSetFields.tsx
Outdated
Show resolved
Hide resolved
packages/smart-forms-renderer/src/components/FormComponents/BooleanItem/BooleanField.tsx
Outdated
Show resolved
Hide resolved
|
@MaryamMehd I have done some brief initial work here but wasn't able to get the non-text fields (with Seems like the text fields are working (the ones with Also it looks like screen reader announcements are interrupted by the field's values announcements sometimes, at least on Mac's Voiceover. It can be inconsistent sometimes. I'm not too sure how to fix that in a clean way - i'm trying to avoid the usage of timeouts. Maybe(?) this can help: https://stackoverflow.com/questions/52427632/aria-live-is-interrupted-by-other-labels-how-to-stop-this-behavior |
- Created AccessibilityErrors.stories.tsx with 3 test stories - Tests verify role='alert' and aria-live='assertive' attributes - Covers String (regex), Integer (minValue), and Text (maxLength) validations - All tests manually verified with VoiceOver on macOS - Errors are announced dynamically without focus change Related to #1745
Apply role='alert' and aria-live='assertive' via slotProps.formHelperText instead of wrapping in AccessibleFeedback component. This ensures the ARIA attributes are on the MUI FormHelperText element that tests query for, fixing the failing AccessibilityErrors Storybook tests.
Change test assertion from 'does not match' to 'should match' to align with the actual regex validation error message: 'Input should match the specified regex'.
… components
- Replace slotProps.formHelperText with helperText={<AccessibleFeedback>{feedback}</AccessibleFeedback>}
- Apply to StringField, IntegerField, and TextField to fix Storybook test failures
- MUI's FormHelperText doesn't forward custom role/aria-live props, so we use the wrapper component
- VoiceOver confirmed to announce error messages properly
Fixes #1745 Storybook test failures
…s tests - Replace conditional if(alertElement) with expect(alertElement).not.toBeNull() - Prevents silent test passes and timeout errors - Ensures tests fail properly if error element is not found This fixes the timeout errors in AccessibilityErrors.stories.tsx Storybook tests.
- Wrap error messages with AccessibleFeedback component using role='alert' and aria-live='assertive' - Apply to StringField, IntegerField, and TextField components - Add StyledRequiredTypography export alias for backward compatibility - Update AccessibilityErrors tests to verify ARIA attributes - Remove unused state variables in OpenChoiceAutocompleteField - Ensure error messages are announced by screen readers per WCAG 2.1 SC 4.1.3
Resolves #1745.
Might need more work to test if screen readers are actually announcing these error messages properly in every component.