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(input, textarea): ensure screen readers announce helper and error text when focused #29958

Merged
merged 6 commits into from
Oct 25, 2024

Conversation

thetaPC
Copy link
Contributor

@thetaPC thetaPC commented Oct 21, 2024

Issue number: internal


What is the current behavior?

Screen readers do not announce helper and error text when user is focused on the input or textarea. This does not align with the accessibility guidelines.

What is the new behavior?

  • The appropriate aria tags are added to the native input and textarea in order to associate them to the helper and error texts.
  • aria-describedBy will only be added to the native element based on helper or error text. If helper text exists then the helper text ID will be used. If the error text exists and the component has the ion-touched ion-invalid classes, then the error text ID will be used.
  • aria-invalid will only be added if the error text exists and the component has the ion-touched ion-invalid classes.
  • Added tests.

Does this introduce a breaking change?

  • Yes
  • No

Other information

How to test:

  1. Navigate to the input page on the main branch
  2. Turn on the screen reader of your choice
  3. Notice that the screen reader does not announce the helper or error text when the input is focused
  4. Navigate to the input page on the ROU-11274 branch
  5. Turn on the screen reader of your choice
  6. Verify that the screen reader announces the helper or error text when the input is focused on
  7. Navigate to the textarea page on the main branch
  8. Repeat steps 2-3
  9. Navigate to the textarea page on the ROU-11274 branch
  10. Repeat steps 5-6

Known Webkit issues:
This fix will not work on macOS 16 and 17 as VoiceOver will not read any text using aria-describedby. Works fine on macOS 18.

Copy link

vercel bot commented Oct 21, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
ionic-framework ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 22, 2024 6:30pm

@github-actions github-actions bot added the package: core @ionic/core package label Oct 21, 2024
@thetaPC thetaPC changed the title fix(input): announce helper and error text in screen readers fix(input): announce helper and error text on focus in screen readers Oct 21, 2024
@thetaPC thetaPC changed the title fix(input): announce helper and error text on focus in screen readers fix(input): ensure screen readers announce helper and error text when focused Oct 21, 2024
@thetaPC thetaPC changed the title fix(input): ensure screen readers announce helper and error text when focused fix(input, textarea): ensure screen readers announce helper and error text when focused Oct 22, 2024
@thetaPC thetaPC marked this pull request as ready for review October 22, 2024 20:33
@thetaPC thetaPC requested a review from a team as a code owner October 22, 2024 20:33
Copy link
Member

@tanner-reits tanner-reits left a comment

Choose a reason for hiding this comment

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

LGTM! Confirmed new behavior using VoiceOver 👍

Copy link
Member

@brandyscarney brandyscarney left a comment

Choose a reason for hiding this comment

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

Verified this works using Android TalkBack and iOS VoiceOver. 👍

@thetaPC thetaPC added this pull request to the merge queue Oct 25, 2024
Merged via the queue into main with commit 5a73145 Oct 25, 2024
52 checks passed
@thetaPC thetaPC deleted the ROU-11274 branch October 25, 2024 19:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package: core @ionic/core package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants