generic

Term side of the Card.
Topic: Structural Elements
Unit title: generic
Categories: Role
Explanation side of the Card

Explanation: The nameless role that browsers assign to elements without semantic meaning, such as `<div>` and `<span>`. Authors should not set it explicitly, since it adds nothing for assistive technologies.

Example

Wronghtml
<div aria-label="Close" onclick="close()">
  ×
</div>
Righthtml
<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-label on a <div> and expecting it to be read.
  • Building buttons from <div>s that stay generic to 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-label is not set on plain <div> or <span>, where the role prohibits naming.

Interview questions

Why is 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?

Both have no meaning. generic is what browsers assign to <div> and <span>; none is set by authors to remove an element's role.

Analytics cookiesWe'd like to use analytics cookies to see which pages are useful. They're set only if you accept. Privacy Policy