Skip to content

Commit

Permalink
Add placeholder text info to text input guidance
Browse files Browse the repository at this point in the history
  • Loading branch information
EoinShaughnessy committed Apr 27, 2022
1 parent 2ec77da commit 708cf71
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/components/text-input/index.md.njk
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,15 @@ Do not use the text input component if you need to let users enter longer answer

## How it works

All text inputs must have visible labels; placeholder text is not an acceptable replacement for a label as it vanishes when users start typing.
All text inputs must have labels, and in most cases the label should be visible.

Labels should be aligned above the text input they refer to. They should be short, direct and written in sentence case. Do not use colons at the end of labels.
You should align labels above the text input they refer to. They should be short, direct and written in sentence case. Do not use colons at the end of labels.

Do not use placeholder text in place of a label, or for hints or examples, as:

- it vanishes when the user starts typing, which can cause problems for users with memory conditions or when reviewing answers
- not all screen readers read it out
- its browser default styles often do not meet [minimum contrast requirements](https://www.w3.org/TR/WCAG22/#contrast-minimum)

If you’re asking just [one question per page](/patterns/question-pages/#start-by-asking-one-question-per-page) as recommended, you can set the contents of the `<label>` as the page heading. This is good practice as it means that users of screen readers will only hear the contents once.

Expand Down

0 comments on commit 708cf71

Please sign in to comment.