Skip to content

docs(material/input): Add information about error messages and color to accessibility section #22772

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 25, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/material/input/input.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,20 @@ for detecting when an input becomes autofilled and changing the appearance of th

The `matInput` directive works with native `<input>` to provide an accessible experience.

#### Aria attributes

If the containing `<mat-form-field>` has a label it will automatically be used as the `aria-label`
for the `<input>`. However, if there's no label specified in the form field, `aria-label`,
`aria-labelledby` or `<label for=...>` should be added.

#### Errors and hints

Any `mat-error` and `mat-hint` are automatically added to the input's `aria-describedby` list, and
`aria-invalid` is automatically updated based on the input's validity state.

When conveying an error, be sure to not rely soley on color. In the message itself, you can use an
icon or text such as "Error:" to indicate the message is an error message.

### Troubleshooting

#### Error: Input type "..." isn't supported by matInput
Expand Down