Skip to content

FRM-017b State a free-text field's length limit and show how much is used

Level
Guideline, our choice
Verdict
Insufficient evidence (1 of 3 judges spoke)
Area
Forms
Status
proposed, version 1.0.0

Rule

When a free-text field limits how many characters or words it takes, state the limit in its label or hint and show how much is used in a count that is tied to the field in code.

Examples

Live examples built with Justified's components. Try them with the mouse, the keyboard or a screen reader.

Do: The limit in the hint, the count tied to the field

Volunteer sign-up

Up to 500 characters

320 characters left

The hint states the limit, and the count under the field says how many characters are left. The field points to both, and the readout shows they are read with it. Type or delete a few characters and pause: a screen reader is told the whole phrase once, politely, and not on every key. The count is not an error.

Do: A word limit works the same way

Volunteer sign-up

Up to 250 words

40 words left

The hint says “Up to 250 words” and the count says how many words are left. Add or delete a word and pause to hear the phrase. The count counts words the way the form does: runs of spaces and line breaks separate them.

Don't: The limit only in the database column

Volunteer sign-up

maxLength is copied from the column and nothing else says there is a limit: no hint and no count. The field holds 480 characters and the person cannot know that 20 more is all there is. Type 25 characters to find out.

Don't: A count nothing points to

Volunteer sign-up

Up to 500 characters

180/500

The count is on the screen, so it looks right. But the field is not described by it and it is not announced: the readout shows the field is read with the hint only, and that a screen reader is told nothing as the number changes.

Don't: A count that interrupts on every key

Volunteer sign-up

Up to 500 characters

320 characters left

The count is tied to the field, but it is an assertive live region, so every key press interrupts what a screen reader is saying. Type a letter: the readout shows the phrase is announced at once, and again for the next key.

Why

A limit people cannot see is one they find only by running into it. Knowing it before they start lets people plan what to write, and a count lets them trim while they write instead of after they are stopped or refused. A screen reader user cannot glance at a counter in the corner, so the count has to be tied to the field and read as words.

No WCAG criterion requires a counter. WCAG 2.2, 3.3.2 Labels or Instructions supports stating the limit, and 4.1.3 Status Messages supports how a changing count reaches assistive technology without taking focus. What happens when the limit is reached is FRM-017c.

Our reasons

Fewer than two judges have spoken about showing a length limit and a count, so the verdict is Insufficient evidence (1 of 3 judges spoke) and this guideline is our choice. Material supports it. So does GOV.UK, an expert witness who does not vote. Carbon and Apple are silent, which is not a vote against. We ask for the limit and the count for three reasons.

  • A rule people cannot see is unfair. The product knows the limit from the start. Keeping it to itself until the text is too long makes the person pay for what the product did not say.
  • Writing to a length is easier with a gauge. A person who sees "120 characters left" can choose what to cut. One who sees nothing finds out when the text stops going in or the form is refused.
  • The count costs little. It is one line of text under the field, tied to it in code.

Do

  • On a volunteer sign-up form, Tell us about yourself has the hint "Up to 500 characters" and a count under the field that reads "320 characters left". The field points to the hint and the count with aria-describedby.
  • Our own choice: the count may appear only once the person is near the limit, such as within 50 characters, as long as the hint states the limit from the start.
  • The count reaches a screen reader as a polite announcement, as FBK-004 describes, and not on every key: for example when the person pauses, or once they are near the limit. It says the whole phrase, "20 characters left", not "20".
  • A word limit works the same way: "Up to 250 words" in the hint and "40 words left" as the count.
  • Count as the server counts. If the server counts a line break or an emoji differently, the visible count matches the server, so nobody is refused below the limit they were shown.
  • The live count is not an error. It may change while the person types. An error for text that is too long appears when they leave the field or send the form, as FRM-002b says.

Don't

  • Copy maxLength={500} from the database column onto Tell us about yourself with no hint and no count.
  • Put the limit only in z.string().max(500), so the first sign of it is an error after the form is sent.
  • Render {value.length}/500 in a <span> that is not tied to the field, so a screen reader user never hears it.
  • Announce the count with aria-live="assertive" on every key, so it interrupts the person as they type.

Exceptions

  • Reaching the limit. What the field says when the limit is reached or passed, and whether it stops input, is FRM-017c.
  • Short coded fields. A postcode, a card number or another code is FRM-017a, which checks the length after cleaning.
  • Paste. Whether a field takes a paste at all is FRM-017.
  • A product that chooses otherwise. This is a guideline. A product without a count still never cuts text in silence (FRM-017c) and shows an error for text that is too long as FRM-002a describes.

Verdict

Insufficient evidence (1 of 3 judges spoke). Only the judges decide; the expert witnesses are shown but do not vote. The judges do not settle this one, so it is a guideline: our own choice, with our reasons above. How verdicts work

Stances on FRM-017b
SourceRoleStancePage
WCAG 2.2LawSupports3.3.2 Labels or Instructions
WCAG 2.2LawSupports4.1.3 Status Messages
Material DesignJudge SupportsText fields: guidelines
Text fields: accessibility
Apple Human Interface GuidelinesJudge No position
Carbon Design SystemJudge No position
GOV.UK Design SystemExpert witness SupportsCharacter count
Nielsen Norman GroupExpert witness No position

Each stance links to the page it rests on, read on the date in the source register. This page never repeats what a source says; read the source itself.

History

  • Version 1.0.0, : First version.

Last checked against the other rules for conflicts on .

More in Forms: 15 rules and 12 guidelines · All rules