ARIA: aria-multiline attribute
Thearia-multiline attribute indicates whether atextbox accepts multiple lines of input or only a single line.
In this article
Description
The default behavior of theEnter orReturn key differs between single-line and multi-line text fields. When user focus is in a single-line<input type="text">, anEnter orReturn keystroke usually submits the form.
When user focus is in a multi-line<textarea>, the keystroke inserts a line break. Only relevant for elements with thetextbox role set, thearia-multiline attribute indicates to assistive technologies whether that text box accepts multiple lines of input or only a single line, setting expectations as to what type of data to enter and what those keystroke will do.
Note:Where possible, use the HTML<input> or the<textarea>, as these have built in semantics and behaviors, do not require ARIA attributes or scripting, and have keyboard support built in.
If thearia-multiline="true" is set, it means the textbox widget will accept line breaks within the input, similar to the HTML<textarea>. Elements with a role oftextbox that do not have the attribute, or with the value set tofalse, are simple text boxes.
Be aware of focus and keystrokes when designing text boxes. ARIA only modifies the accessibility tree and therefore how assistive technology presents the textbox to your users. ARIA doesn't change anything about an element's default function or behavior. When not using semantic HTML elements for their intended purpose and default functionality, you must use JavaScript to manage behavior and functionality, including responding to keystroke events.
Values
Associated interfaces
Element.ariaMultiLineThe
ariaMultiLineproperty, part of theElementinterface, reflects the value of thearia-multilineattribute.ElementInternals.ariaMultiLineThe
ariaMultiLineproperty, part of theElementInternalsinterface, reflects the value of thearia-multilineattribute.
Associated roles
Used in roles:
Inherits into roles:
Specifications
| Specification |
|---|
| Accessible Rich Internet Applications (WAI-ARIA)> # aria-multiline> |