Background
- Description: we need to implement characters counter to use it in TextArea T284272
- History: characters counter discussed in the Field component task T309239#8638272
- Known use case(s):
- Considerations: list any known challenges or blockers, or any other important information
User stories
- As a user, I need to know how many characters I can type in an input.
- As a user, I need to know when I'm exceeding the characters when typing in an input.
Previous implementations
- See T338817#9133502 for description of existing MediaWiki implementations using wgCommentCodePointLimit
- Wikifunctions implements a custom front-end-only character counter for TextInputs (see T331000#9155716).
Design explorations
Some design explorations are captured in this Figma file:
Design spec
Once a component spec sheet has been created in Figma, remove the note stating the spec is missing and link to the spec below.
Component spec sheet |
Open questions
- We need to evaluate if we want to indicate the exceeded characters and, if yes, the style for these exceeded characters.
- We need to define the right padding between the helper text and characters counter so both texts are not too close to each other when the helper text is too long. Also, we need to define the maximum case to know how both texts grow when they are long.
- Do we want to implement the error validation message as part of the characters counter?
Acceptance criteria (or Done)
Design
- Design the Figma spec sheet and add it in this task
- Update the component in the Figma library. This step will be done by a DST member.
Code
- Implement the component in Codex