Fix Button Accessibility in Lighthouse
Correcting accessibility errors in Lighthouse using HTML element attributes
March 7, 2023
731 ViewsShort Answer
Add text to the button.
<button>Submit</button>
If a button does not have text, add an aria-label attribute to the element.
<button aria-label="Close">×</button>
If a button contains an image, use the alt tag on the image element.
When you place an img within a button, the button takes its accessible name from the image.
<button>
<img src="close.png" alt="close" />
</button>
π Don't Miss Out on the Full Content of this articleπ
Unlock your full potential by gaining access to our exclusive content.
The exclusive content for this article includes:
- π€ Why is it Important to make Buttons Accessible
- π What is Aria-label?
- π§ How does aria-label make buttons accessible?
- π·οΈ Describing the button's function
- π Making the button visible
- π‘ Benefits of using aria-label
- βΏ Improved accessibility
- π Compliance with accessibility standards
- π Improved user experience
π Click the Subscribe button below and gain immediate access to our comprehensive resources! Subscribe now and elevate your skills!