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(storefront): BCTHEME-1092 Make screen reader say all errors then … #2230

Merged
merged 1 commit into from Jul 28, 2022
Merged

fix(storefront): BCTHEME-1092 Make screen reader say all errors then … #2230

merged 1 commit into from Jul 28, 2022

Conversation

huntario
Copy link
Collaborator

@huntario huntario commented Jun 28, 2022

…each error while tabbing

Watching - #2235 - before moving forward

What?

Currently screen readers do not read out the errors until after the second submission, this seems to be do to the error not being defined within 'announceInputErrorMessage' assets/js/theme/common/utils/form-utils.js:132

So the role alert is not attached as expected. Once attached (after the second submission), the alert is too intrusive. The alerts interrupt each other causing the reading to not be audible.

Also, once the user is tabbing through each input, it should remind them of the specific error for that input field.

announceInputErrorMessage Does not seem to be firing as expected on any of the forms and should likely be replaced with different solution, but we will just replace it for the account signup for now; and remove it further from other forms on separate tickets.

Requirements

  • CHANGELOG.md entry added (required for code changes only)

Tickets / Documentation

Add links to any relevant tickets and documentation.

Screenshots (if appropriate)

Before:

BCTHEME-1092-announceInputErrorMessage-not-triggered-initially.mp4
BCTHEME-1092-before.mp4

After:

BCTHEME-1092-after.mp4

@huntario huntario marked this pull request as ready for review June 28, 2022 02:25
@bc-yevhenii-buliuk
Copy link
Contributor

bc-yevhenii-buliuk commented Jul 12, 2022

Hi @huntario! It seems that two similar tasks were created to solve the problems of form accessibility and the correct operation of the screen reader (1092 and 1128) .
Could you take a look at the solution to this problem in the PR that I created for my task 1128?
In my solution, I added an additional key delay: 0 to the nod validator settings so that the validator can immediately detect the error message that is in the span element:

`const errorMessage = $(activeInputContainer).find('span.form-inlineMessage');`

this should save us from double-clicking the form's submit button or losing focus twice on input elements to detect the errorMessage.
Thanks to this, we can immediately add the necessary attributes to errorMessage which will improve accessibility.
I also implemented adding focus to the first non-valid input field when submitting a form with non-valid fields. This will save us from the continuous enumeration of input field errors from the screen reader. It also looks more user friendly.
I will be grateful if you share your opinion on this matter. Thank you!

@bc-yevhenii-buliuk
Copy link
Contributor

@huntario it would be nice to implement logic to set focus to the first non-valid input field when submitting the form.

@huntario
Copy link
Collaborator Author

huntario commented Jul 19, 2022

Thanks for the review @bc-yevhenii-buliuk . I've addressed the notes you mentioned. Let me know if you have any remaining concerns. I also moved the submit code into it's own method. This code is repeated in other methods here and could be consolidated in the future.

@bc-as bc-as merged commit 02cad1c into bigcommerce:master Jul 28, 2022
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.

None yet

4 participants