Skip to content

Image button without alternative text

a11y-input-image-altcritical
On this page

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

Wrong
<input id="search" type="image" src="/img/search.svg" width="24" height="24" />
Right
<input id="search" type="image" src="/img/search.svg" width="24" height="24" alt="ابحث في المتجر" />

How to fix

  • Add an alt that 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 with alt="", and visible text or an aria-label.

How we detect

  1. We render the page and run axe-core 4.13.0's input-image-alt rule in each engine.
  2. It reports each <input type="image"> without an accessible name: no alt, aria-label, aria-labelledby or title. An empty alt="" is not enough here: a button is never decoration for a screen reader to pass over.
  3. It does not apply to pages without image buttons.