Skip to content

fix: Add characterCountText to form field for improved screen reader support#4332

Merged
avinashbot merged 4 commits intomainfrom
feat/character-count-text
Mar 16, 2026
Merged

fix: Add characterCountText to form field for improved screen reader support#4332
avinashbot merged 4 commits intomainfrom
feat/character-count-text

Conversation

@avinashbot
Copy link
Member

@avinashbot avinashbot commented Mar 4, 2026

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

  • Changes include appropriate documentation updates.
  • Changes are backward-compatible if not indicated, see CONTRIBUTING.md.
  • Changes do not include unsupported browser features, see CONTRIBUTING.md.
  • Changes were manually tested for accessibility, see accessibility guidelines.

Security

Testing

  • Changes are covered with new/existing unit tests?
  • Changes are covered with new/existing integration tests?

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@avinashbot avinashbot force-pushed the feat/character-count-text branch from 181839c to d0adbdd Compare March 5, 2026 00:54
@avinashbot avinashbot marked this pull request as ready for review March 5, 2026 00:54
@avinashbot avinashbot requested a review from a team as a code owner March 5, 2026 00:54
@avinashbot avinashbot requested review from ernst-dev and removed request for a team March 5, 2026 00:54
@codecov
Copy link

codecov bot commented Mar 5, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.44%. Comparing base (f7f12ee) to head (ea583aa).
⚠️ Report is 21 commits behind head on main.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@avinashbot avinashbot marked this pull request as draft March 6, 2026 10:44
@avinashbot avinashbot force-pushed the feat/character-count-text branch from d1b03ae to ea583aa Compare March 13, 2026 00:40
@avinashbot
Copy link
Member Author

avinashbot commented Mar 13, 2026

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)

@avinashbot avinashbot added this pull request to the merge queue Mar 16, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Mar 16, 2026
@avinashbot avinashbot added this pull request to the merge queue Mar 16, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Mar 16, 2026
@avinashbot avinashbot added this pull request to the merge queue Mar 16, 2026
Merged via the queue into main with commit 9c18a34 Mar 16, 2026
84 of 85 checks passed
@avinashbot avinashbot deleted the feat/character-count-text branch March 16, 2026 13:04
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