InputMask
WARNING
InputMask is deprecated and will be removed in the next major release.
What component has
Keyboard support
| Key | Function |
|---|---|
Tab | Moves focus to the next focusable element. |
Shift + Tab | Moves focus to the previous focusable element. |
Enter | Submits the entered value. |
See detailed information about the keyboard support for the input fields in the Keyboard control guide.
Considerations for developers
- Use labels for every input and make the
for=""andid=""values match. IDs must be unique on each page, only one label can be associated to each unique form element. Keep it simple – do not all browsers correctly expose multiple labels that are linked to the same form element. - Make optional fields obvious by adding text "optional" to the input.
- Inputs with the
invalidstate should be associated with their error message usingaria-describedby.
Considerations for designers
- Provide visible text instructions for inputs with constraints, such as a specific format for data.
- Focus must be visible.
- Don’t hide the input label on focus.
Resources
- A11y style guide describes core principles for the accessible inputs and textarea.
- Forms tutorial from W3C helps you understand common methods for creating accessible forms.
- Find live examples of accessible inputs with different types in DigitalA11y project.
Other recommendations
Find more accessibility recommendations in the common Accessibility guide.