Form submit and reset buttons
The button pattern allows the user to input a command, with one of the following possible action types:
- 1.Submit form (type="submit")
- 2.Reset form (type="reset")
The first two types of button are for use inside of a form only, due to their specific behaviour.
The third type is a general purpose button used for running client-side script. This type of button appears in many patterns:
TIP: If left unspecified, the type attribute has a default value of "submit".
The label must clearly indicate the purpose of the button (i.e. not 'click here' or 'click me').
A button may update the hash fragment of the URL. For example, if building a single page app experience and explicitly managing the History API.
A button may display a waiting/loading state, but should not be a live-region (see: FAQ: When should a live-region be used?). Some screen readers automatically announce any changes to the programmatic label, and so using a live-region would trigger a second, redundant announcement.
Buttons should not have a hand cursor.
If button has focus,
ENTERkeys should activate button.
If button has focus,
SHIFT-TABkeys should move to the next or previous focusable page element respectively.
If virtual cursor is on button, it must be invokable by virtual cursor (e.g. VO+SPACE in VoiceOver).
Role of 'button' must be announced.
Label must be announced.
Any state must be announced (e.g. expanded, haspopup).
Any description must be announced (i.e. via aria-describedby).
Any change in label (e.g. a waiting/loading state) may be announced by the screen reader (NOTE: a live-region should not be used for this).
We do not supply a developer guide for buttons because you should always use the button tag!
The only exception to this rule is an anchor tag that is progressively enhanced into a button.
The button tag is straightforward, 100% accessible, and 100% style-able with CSS. However, there are three cases that might need extra care and attention:
This section lists all relevant ARIA roles, states and properties for a button.
Informs AT that the button controls another element.
Informs AT of the expanded state of any associated element or content
Creates a label for the button. Warning! This label will override any inner text that may be present. This property is most commonly used for icon buttons.
Informs AT of any extended description or context related to the button. Note that this property has no effect on the accessible label of the button.