govuk-frontend
govuk-frontend copied to clipboard
Add ability to customise character count text that announces character/word limit / no-js fallback
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](https://user-images.githubusercontent.com/29889908/178487765-b893aaba-821b-4e36-8c10-e161f5c77862.png)
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