Why it matters
<input type="image">is a button drawn as a picture, such as a search lens or a "buy now" picture. Its alternative text is its name. Without one, a screen reader announces only a button, or reads the image's file name.- WCAG 2.2 asks for a text alternative that gives the purpose of every non-text control (success criterion 1.1.1, level A), and a name for every control (success criterion 4.1.2, level A).
Example
<input id="search" type="image" src="/img/search.svg" width="24" height="24" />
<input id="search" type="image" src="/img/search.svg" width="24" height="24" alt="ابحث في المتجر" />
How to fix
- Add an
altthat says what the button does, not what the picture shows:<input type="image" src="/img/search.svg" alt="ابحث في المتجر">. - Or use a
<button>holding the picture withalt="", and visible text or anaria-label.
How we detect
- We render the page and run axe-core 4.13.0's
input-image-altrule in each engine. - It reports each
<input type="image">without an accessible name: noalt,aria-label,aria-labelledbyortitle. An emptyalt=""is not enough here: a button is never decoration for a screen reader to pass over. - It does not apply to pages without image buttons.