Skip to content
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

fix(a11y): error message announcement in form elements (VIV-1593) #1662

Merged
merged 8 commits into from
Apr 10, 2024

Conversation

TaylorJ76
Copy link
Contributor

@TaylorJ76 TaylorJ76 commented Apr 5, 2024

This can be tested by dynamically adding the error-text and the screen reader should announce it.

@TaylorJ76 TaylorJ76 marked this pull request as draft April 5, 2024 09:46
@TaylorJ76 TaylorJ76 marked this pull request as ready for review April 5, 2024 09:51
Copy link

codecov bot commented Apr 5, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (d61b119) to head (b60fcda).
Report is 894 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff             @@
##              main     #1662     +/-   ##
===========================================
  Coverage   100.00%   100.00%             
===========================================
  Files          123       322    +199     
  Lines         1562      5411   +3849     
  Branches       108       667    +559     
===========================================
+ Hits          1562      5411   +3849     
Flag Coverage Δ
unittests 100.00% <100.00%> (ø)

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

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

Comment on lines 258 to 260
role="${config.messageProperty === 'errorValidationMessage'
? 'status'
: 'none'}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not make it part of the config?

Suggested change
role="${config.messageProperty === 'errorValidationMessage'
? 'status'
: 'none'}"
role="${config.status ?? 'none'}"

'message',
`${config.className}-message`,
['message--visible', shouldShow(x)],
['sr-only', !shouldShow(x)]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this needed? Because when the error is not visually displayed it also shouldn't be accessible to SR, right?

Suggested change
['sr-only', !shouldShow(x)]

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When it is hidden with display: none the message is not announced.

Comment on lines 22 to 24
&.error-message {
display: flex;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kind of confusing, maybe better to always apply message--visible for error message through code instead

Suggested change
&.error-message {
display: flex;
}

@TaylorJ76 TaylorJ76 merged commit 3bc7707 into main Apr 10, 2024
16 checks passed
@TaylorJ76 TaylorJ76 deleted the VIV-1593-time-picker-a11y-fix branch April 10, 2024 06:24
@github-actions github-actions bot mentioned this pull request Apr 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants