govuk-frontend icon indicating copy to clipboard operation
govuk-frontend copied to clipboard

Add ability to customise character count text that announces character/word limit / no-js fallback

Open vanitabarrett opened this issue 2 years ago • 0 comments

What

The character count has a 'count message' which is visually hidden when JavaScript is available, used by screenreader users. It tells the user the character or word limit for the character count, e.g: "You can enter up to 10 characters". It is visible when JavaScript is disabled, example:

Screenshot 2022-07-12 at 13 15 50

This issue is for adding the ability for users to customise that text. At the moment, it is hardcoded in the component template as "You can enter up to [x] [words/characters]".

Why

This functionality is needed for users to be able to fully translate the character count text.

Who needs to work on this

Developers

Who needs to review this

Developers

Done when

  • [x] Character count macro options allow a user to pass translated text for the count message
  • [x] This works whether they're setting maxwords or maxlength
  • [x] We're not adding any hardcoded content order (i.e: expecting the 'count' number to appear in a certain place in the string
  • [x] There is an example of this in the review app
  • [x] There are tests for this

vanitabarrett avatar Jul 12 '22 12:07 vanitabarrett