This is a short overview of the background and decisions that need to be made to map the maxlength
HTML attribute and create an aria-maxlength
ARIA attribute.
Although the HTML maxlength
prop can be used to limit characters in native inputs, it has no accessibility mappings and is not communicated to screen reader users (either up front or when the character limit is reached).
This becomes a pain point when authoring text inputs that have character limits in several ways:
- It necessitates a custom live region announcement when the character limit is approaching and exceeded, despite there often being no visual text equivalent.