WAI-ARIA: Role=Textbox
Description
A type of input that allows free-form text as its value.
If the aria-multiline attribute is true, the widget accepts line breaks within the input, as in an HTML textarea. Otherwise, this is a simple text box. The intended use is for languages that do not have a text input element, or cases in which an element with different semantics is repurposed as a text field.
Note: In most user agent implementations, the default behavior of the ENTER or RETURN key is different between the single-line and multi-line text fields in HTML. When user has focus in a single-line <input type=”text”> element, the keystroke usually submits the form. When user has focus in a multi-line <textarea> element, the keystroke inserts a line break. The WAI-ARIA textbox role differentiates these types of boxes with the aria-multiline attribute, so authors are advised to be aware of this distinction when designing the field.
Role=Textbox Example
HTML Example
<textarea role="textbox"></textarea>
Characteristics
Superclass Role
- input
Subclass Roles
- searchbox
Related Concepts
- XForms input
- HTML textarea
- HTML input[type=”text”]
Supported States and Properties
- aria-activedescendant
- aria-autocomplete
- aria-multiline
- aria-placeholder
- aria-readonly
- aria-required
Inherited States and Properties
- aria-atomic
- aria-busy (state)
- aria-controls
- aria-current (state)
- aria-describedby
- aria-details
- aria-disabled (state)
- aria-dropeffect
- aria-errormessage
- aria-flowto
- aria-grabbed (state)
- aria-haspopup
- aria-hidden (state)
- aria-invalid (state)
- aria-keyshortcuts
- aria-label
- aria-labelledby
- aria-live
- aria-owns
- aria-relevant
- aria-roledescription
Name From
- author
Accessible Name Required
- True
Semantic HTML
Use the HTML <input type=“text”> or <textarea> tag.
<form>
First name:<br>
<input type=”text” name=”firstname”><br>
Last name:<br>
<input type=”text” name=”lastname”>
</form>
<textarea name=”textarea”
rows=”10″ cols=”50″>Write something here</textarea>
Reference
- WAI-ARIA 1.2 Specification
Refer to the notes from the WAI-ARIA 1.2 specification for more information on role=textbox.