The Dispossessed
Due back 3 December
Everything people click or tap to go somewhere or to act has a control role in code, such as link or button. Something shown as a link whose only job is to take people to another address has the link role.
Live examples built with Justified's components. Try them with the mouse, the keyboard or a screen reader.
Due back 3 December
<a href>, and Renew loan and the star are buttons. The list under the card is what a screen reader’s lists of links and buttons hold. Tab reaches all three. A plain click on the link only reports where it would go, so Storybook stays put; the real href is still there, so Ctrl or Cmd click opens the address in a new tab, as on any link (Storybook has no such page).Due back 3 December
article with onClick. The list is empty of links: nothing here is a link, so a screen reader reads the title as text. Tab skips the card, so this opening works with a pointer only. The one button, Renew loan, is real and stops the click from reaching the card.Button variant="link" asChild around an <a href>. It looks like a text link and is announced as one. Download loan history (CSV) is a link to the file, as it still goes to an address. Plain clicks report where they would go; Ctrl or Cmd click, a middle click and Copy link address work for real (Storybook has no such page).Monday to Friday 9 to 18, Saturday 10 to 14.
Button variant="link" onClick that changes the address by script. It works with Tab and Enter, but a screen reader calls it a button, and it is not in the list of links. A middle click or Copy link address has no address to use.Due back 3 December. Late fees
<a> with no href, Late fees an underlined span and the star an icon, each with onClick. A click with a pointer works. In HTML none of them has a role, so the list is empty. Chrome guesses link for the anchor from its click handler, but Tab still cannot reach it, and other browsers read it as text. Tab reaches none of the three: this example cannot be used with a keyboard at all.A screen reader tells people what each thing is before they use it: "link", "button", "menu item". It also lets them jump through a list of every link or every button on the page. A div, span or image with a click handler is none of these. It has no control role: it is read as plain text, if it is reached at all, and it is missing from those lists, so the person may never learn that it does anything. WCAG 2.2, 4.1.2 Name, Role, Value requires that every control, scripted ones included, has a role software can work out. The Working Group lists a generic element made clickable by script without a role as a failure (F59). It also fails anything presented as a link that reaches its target by script while its role is not link (F42), even when it works from the keyboard. An anchor with no href is not a link in HTML, so it has no control role either. The criterion asks for the role, not for a native element; building with <button> and <a href> is the Working Group's advice and ours. That every control also works from the keyboard (2.1.1 Keyboard) is KBD-001. 1.3.1 Info and Relationships supports this rule, since a fake link loses what the page shows about it.
Card. The book's title is a Link to its page and Renew loan is a Button. A click elsewhere on the card may open the book's page as a shortcut, as KBD-001 allows.<Button variant="link" asChild><Link href="/branches">All branches</Link></Button> renders an <a href>.Button size="icon" with the lucide Star inside, named as ACT-001b says.Button in DialogTrigger, DropdownMenuTrigger or PopoverTrigger when you use asChild. Without asChild they render a <button> themselves.<button> and <a href>. The adapter's Button renders <button type="button">, or the element you give it with asChild, and Next.js and React Router Link render <a href>.role="button" or role="link", tabIndex={0}, Enter (and Space for a button), aria-disabled when it is off, any other state it has (VIS-008a), and a name (ACT-001b). Enter and Space are our advice; keyboard use is KBD-001. That can meet the criterion, but it is the worse way.<a href="/loans.csv" download>.onClick={() => router.push("/books/" + book.id)} on the Card and nothing inside it that is a link.<a onClick={renewLoan}>Renew loan</a> with no href. It has no role in HTML and takes no focus.<Button variant="link" onClick={() => router.push("/branches")}>. It looks like a link and goes somewhere, but a screen reader calls it a button and it is not in the list of links.span with cursor-pointer that calls navigate("/fees").onClick straight on the lucide Star icon.span inside PopoverTrigger asChild, so the trigger loses the button it would have rendered.role="button" or role="link" on a th, tr or TableRow to make it clickable. Put the control inside, as TBL-002 and TBL-003 say.Requirement. Only the judges decide; the expert witnesses are shown but do not vote. How verdicts work
| Source | Role | Stance | Page |
|---|---|---|---|
| WCAG 2.2 | Law | Requires | 4.1.2 Name, Role, Value |
| WCAG 2.2 | Law | Supports | 2.1.1 Keyboard |
| WCAG 2.2 | Law | Supports | 1.3.1 Info and Relationships |
| Material Design | Judge | Supports | Accessibility designing: elements |
| Apple Human Interface Guidelines | Judge | No position | |
| Carbon Design System | Judge | Supports | Button: usage Link: usage |
| GOV.UK Design System | Expert witness | Supports | Button |
| Nielsen Norman Group | Expert witness | No position |
Each stance links to the page it rests on, read on the date in the source register. This page never repeats what a source says; read the source itself.
Last checked against the other rules for conflicts on .
More in Actions: 11 rules and 4 guidelines · All rules
Justified is an independent project. It is not affiliated with, sponsored or endorsed by the organisations whose guidance it cites. Read the full statement.
Apple is a trademark of Apple Inc., registered in the U.S. and other countries and regions.