fix: Add characterCountText to form field for improved screen reader support#4332
fix: Add characterCountText to form field for improved screen reader support#4332avinashbot merged 4 commits intomainfrom
Conversation
181839c to
d0adbdd
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4332 +/- ##
==========================================
+ Coverage 97.43% 97.44% +0.01%
==========================================
Files 897 897
Lines 26342 26412 +70
Branches 9517 9531 +14
==========================================
+ Hits 25667 25738 +71
- Misses 632 668 +36
+ Partials 43 6 -37 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
d1b03ae to
ea583aa
Compare
|
Moved back to draft to test out a LiveRegion-based alternative, but it was messy and didn't work out very well. The current option isn't great either, because the announcement of the actually changed text (Character count: x/y) is frontloaded by (potentially) multiple sentences of completely static aria-describedby content. But this is the best we can do — this entire PR only exists to work around a serious bug with NVDA/JAWS. @ernst-dev So not much actually changed since your last review (other than addressing your naming comment, which was a great pick) |
Description
Apparently, NVDA/JAWS don't fare well when you update the accessible description of an input you're focused on after every keypress, and end up interrupting everything else, like the keypress announcements themselves.
This introduces a new string property,
characterCountText, whose updates are debounced for screen readers. This also means that only the updated section of the constraint text ("Character count: x/y") is announced when it changes.Related links, issue #, if available: AWSUI-61742
How has this been tested?
Added unit tests and a test util method.
Provisioning a Windows machine right now, but I'll also let our accessibility specialists take a crack at it before merging. But in the meantime, the code itself is reviewable.
Review checklist
The following items are to be evaluated by the author(s) and the reviewer(s).
Correctness
CONTRIBUTING.md.CONTRIBUTING.md.Security
checkSafeUrlfunction.Testing
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.