what is aria lable?
- User
what is aria lable?
Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
what is aria lable?
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
ARIA Label (Accessible Rich Internet Applications label) is an HTML attribute that provides an accessible name for elements when the visible text isn't sufficient or doesn't exist. It helps assistive technologies like screen readers understand the purpose of interactive elements.
aria-label="descriptive text"| Scenario | Example |
|---|---|
| Icon buttons | <button aria-label="Close">×</button> |
| Decorative images | <img src="divider.png" aria-label="Decorative divider"> |
| Complex controls | <div role="slider" aria-label="Volume control">...</div> |
| Insufficient text | <button>Read More<span aria-label="about accessibility features"></span></button> |
| Attribute | Best For | Example |
|---|---|---|
| aria-label | Elements with no visible text | <button aria-label="Search"><svg>...</svg></button> |
| aria-labelledby | Referencing existing text | <button aria-labelledby="textId"><svg>...</svg></button> |
| alt text | Informative images | <img src="logo.png" alt="Company logo"> |
| Visible labels | Preferred when possible | <label for="search">Search</label><input id="search"> |
function AccessibleComponent() {
return (
<div>
{/* Icon button without visible text */}
<button
aria-label="Close modal"
onClick={() => console.log("Modal closed")}
className="icon-button"
>
<svg width="24" height="24">
<path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"/>
</svg>
</button>
{/* Progress indicator */}
<div
role="progressbar"
aria-label="File upload progress"
aria-valuenow="75"
aria-valuemin="0"
aria-valuemax="100"
>
<div className="progress-bar" style={{ width: '75%' }}></div>
</div>
{/* Collapsible section */}
<div>
<button
aria-expanded="false"
aria-label="Show additional options"
aria-controls="options-section"
onClick={(e) => e.currentTarget.setAttribute('aria-expanded', 'true')}
>
Options ▾
</button>
<div id="options-section" hidden>
{/* Additional options here */}
</div>
</div>
</div>
);
}
<button> over <div role="button">)aria-expanded, aria-haspopup)<label>, <alt>)ARIA labels are essential for making modern web applications accessible, especially for complex UI components and icon-based interfaces where visual cues alone aren't sufficient for all users.