
Pawar ShivamMost developers know the basics of Alt Text for images. But when building modern apps with complex...
Most developers know the basics of Alt Text for images. But when building modern apps with complex UI, alt text alone is not enough. Thatβs where ARIA attributes come in.
Letβs go deeper.
Alt text (alt) is specifically designed for images.
It tells screen readers what the image represents.
<img src="dashboard-chart.png" alt="Line chart showing user growth from January to June">
β Product images
β Blog images
β Icons that convey meaning
β Charts or graphs
If the image is purely decorative, use an empty alt.
<img src="divider.png" alt="">
This tells screen readers to ignore it.
In real projects we often have:
div buttonsExample:
<button>
<svg>...</svg>
</button>
A screen reader will just say:
"button"
No context.
aria-label β Adding Meaning to UI
aria-label provides accessible text for elements that don't have visible text.
<button aria-label="Close modal">
<svg>...</svg>
</button>
Now screen readers say:
"Close modal button"
<button aria-label="Search">
<svg>...</svg>
</button>
<a href="#" aria-label="Open Twitter profile">
<svg>...</svg>
</a>
<input type="text" aria-label="Search products">
aria-labelledby (Better for Dynamic UI)
Instead of writing text again, reference an existing element.
<h2 id="modal-title">Delete Account</h2>
<button aria-labelledby="modal-title">
Confirm
</button>
Screen readers read:
"Delete Account Confirm button"
This keeps content consistent and maintainable.
π Always use semantic HTML first.
Bad example:
<div onclick="openMenu()">Menu</div>
Better example:
<button>Menu</button>
ARIA should enhance accessibility, not replace proper HTML.
Before shipping UI:
β Every meaningful image has alt text
β Icon-only buttons have aria-label
β Inputs have labels or aria-label
β Use semantic elements like button, nav, header, main
β Decorative images use alt=""
π‘ Accessibility is not just about compliance.
It's about building products everyone can use.
Good developers make things work.
Great developers make things accessible.