alphagov / govuk-frontend

GOV.UK Frontend contains the code you need to start building a user interface for government platforms and services.
https://frontend.design-system.service.gov.uk/
MIT License
1.18k stars 325 forks source link

Hint text for a character count is included by screen readers as part of the count message #2486

Closed 36degrees closed 2 years ago

36degrees commented 2 years ago

Description of the issue

If a character count also has a hint associated with the textarea, some screen readers also include the hint text whenever the count message is announced.

Steps to reproduce the issue

  1. Go to https://govuk-frontend-review.herokuapp.com/components/character-count/with-hint/preview
  2. Focus the textarea and wait for the accessible name, type and description to be read
  3. Enter characters in the text area

Actual vs expected behaviour

Expected: Only the count message should be announced, for example "You have 9 characters remaining."

Actual: The hint text is also announced in:

"You have 5 characters remaining. Don't include personal or financial information, eg your National Insurance Number or credit card details."

This hint text was also announced very occasionally in VoiceOver / Safari 15.2 (macOS Big Sur) with no discernible pattern.

JAWS 2021.2103.174 / IE11 and VoiceOver / Safari (iOS 15.2) behave as expected, announcing only the remaining count.

Environment (where applicable)

36degrees commented 2 years ago

I believe this is likely because changes to the accessible description are announced a little like live regions (the character count message is associated with the textarea using aria-describedby).

See also https://www.davidmacd.com/blog/test-aria-describedby-errormessage-aria-live.html

Some overlap with #2485.