Accessibility · Junior · Question 42 of 75
An icon-only close button has no text. How do you give it a name?
<button>
<svg aria-hidden="true">...</svg>
</button>- 1Add
aria-label="Close"to the button - 2Add
role="icon"to the button element - 3Add
title="svg"to the icon element
Show the answer
Correct answer: Add aria-label="Close" to the button
Explanation
Without a name, a screen reader only says "button". Visually hidden text inside the button works too, and it's translated by browser tools more reliably.