Button: Button is missing both a role and a name
button-role-name-missing
Rule
The name, role, value, states, and properties of user interface components MUST be programmatically determinable by assistive technologies.
Background
Every user interface control must have a role to convey what type of control it is for screen reader and other assistive technology users. Native HTML elements - such as <button>, <a>, <input>, <select> - already have a role, so nothing more needs to be done. If you create a custom version of a native HTML element or a custom control or widget that does not have a native HTML equivalent, you must add the relevant role(s) using ARIA as well as expected keyboard interactions.
Buttons must have discernible text that describes the button's function or action for screen reader and other assistive technology users.
How to Fix
To fix this issue, BOTH a ROLE and a NAME must be provided for the button.
Provide a ROLE by using one of the following techniques:
- Use a native HTML <button> element.
<button>Apply now!</button>
- Add role="button" to the custom button container. NOTE: If you use role="button" instead of <button>, you will need to ensure Enter and Spacebar can activate the button.
<span role="button" class="apply-btn" aria-label="Apply Now!"></span>
Provide a NAME by using any of the following techniques:
- Use the innertext of the <button> or role="button" element
<button>Apply now!</button>
<button class="apply-btn"><span class="sr-text">Apply now!</span></button>
- Use a non-empty aria-label attribute on the <button> or role="button" element.
<button class="apply-btn" aria-label="Apply now!"></button>
<span role="button" class="apply-btn" aria-label="Apply Now!"></span>