Text fields: Accessibility
Text fields let users enter text into a UI
Use cases
User should be able to:
- Navigate to and activate a text field with assistive technology
- Input information into the text field
- Receive and understand supporting text and error messages
- Navigate to and select interactive icons
Interaction & style
The containers for both filled and outlined text fields provide the same functionality. Changes to color and thickness of stroke help provide clear visual cues for interaction.


Containers improve the discoverability of text fields by creating contrast between the text field and surrounding content.
In some contexts, outlined text fields can improve the perception of the fields with a 3:1 or greater contrast ratio between the container outline and the background.


Keyboard navigation
| Keys | Actions |
|---|---|
| Tab | Focus lands on (non-disabled) text field |
Labeling elements
If the UI text is correctly linked, assistive tech (such as a screenreader) will read the UI text followed by the component’s role.
The accessibility label for a text field is the same as the text field label.

For text fields with interactive trailing icons, the accessibility label clarifies its function.
For example, when a password is hidden, the label for the view icon is "Show password," and when the password is visible, the label is "Hide password."
When an icon has no actionable role, like an error icon, the label is "Error."

The prefix and suffix of a text field provides symbols and abbreviations to help users enter the correct values.
The accessibility label for prefix and suffix needs to have a unique id attribute, for example, the currency name for a currency symbol prefix.

When there is an error, "alert" is applied to the role and the error message to the text label.
If a text field displays both supporting text and error text, the label should include the supporting text first, followed by the error text.

The accessibility label for the character counter clarifies the number of characters that can be entered into the text field.

The text displayed in the supporting text is also used for its accessibility label.
![The accessibility label uses the supporting text. It reads: UI text (“Please use the company email address”). Role [No role].](https://cdn.w3cbus.com/getbook/book-assets/material-design-3/components/text-fields/accessibility/supporting-text-label.png)
If a text field requires input, indicate so with an asterisk at the end of the text field label. The accessibility label must include the asterisk.
