generic
Example
<div aria-label="Close" onclick="close()">
×
</div><button type="button" aria-label="Close" onclick="close()">
×
</button>A <div> is generic and cannot take a name; a <button> gives role, name and keyboard support.
Common mistakes
- Putting
aria-labelon a<div>and expecting it to be read. - Building buttons from
<div>s that staygenericto assistive technologies.
Key points
- No element sets
role="generic"explicitly. - Interactive or meaningful content is not left as
<div>or<span>with click handlers. aria-labelis not set on plain<div>or<span>, where the role prohibits naming.
Interview questions
Why is aria-label ignored on a <div>?
aria-label ignored on a <div>?A plain <div> has the generic role, which prohibits an accessible name, so many screen readers ignore the label.
What is the difference between generic and none?
generic and none?Both have no meaning. generic is what browsers assign to <div> and <span>; none is set by authors to remove an element's role.