Component - Button examples


Icon-Only Button (With ARIA Label)

Purpose: Ensure assistive tech understands the button's purpose.

<button type="button" aria-label="close">

This defines a button with image icon and that only aria-label is announced.

HTML Code


    <button type="button" aria-label="Close">
        <img src="close-button.png" >
    </button>
   

Assistive technologies

NVDA - Screen Reader announcement

Why it's accessible:


Icon-Only Button (With ARIA hidden set)

Purpose: Ensure assistive tech understands the button's purpose and its aria hidden value.

<button type="button" aria-hidden="true" tabindex="-1">

This defines a button with image icon with aria-hidden="true" and is skipped and not announced but the Screen Reader.

HTML Code


    <button aria-hidden="true" tabindex="-1">
        <img src="close-button.png" >
    </button>
   

Assistive technologies

NVDA - Screen Reader announcement

Why it's not accessible:

Back to component list