Sub topic 15
Mapping Design Intent to Native HTML and ARIA
Assume you know basic HTML, CSS, forms, and wireframing. This chapter focuses on handoff: translating a wireframe’s interaction intent into HTML semantics that assistive technology can understand.
Start with native HTML
Native HTML is HTML with built-in meaning and behavior. A <button> is announced as a button and can be activated from the keyboard. A <nav> identifies a navigation region. A <label> gives a form control a name.
Use the element that already matches the wireframe’s purpose. Add ARIA only when native HTML cannot express the required meaning or state. ARIA, the Accessible Rich Internet Applications specification, adds roles, states, and properties to elements. It does not automatically add keyboard behavior, focus management, or visual styling.
| Design intent | Preferred HTML | Handoff detail |
|---|---|---|
| Navigate to another page | `<a href="...">` | Write link text that names the destination |
| Perform an action | `<button type="button">` | Specify its action and state |
| Group main navigation | `<nav aria-label="Main">` | Give similar landmarks distinct labels |
| Collect user input | `<label>` and `<input>` | Keep the label visible |
| Show a page section | `<section aria-labelledby="...">` | Connect it to a heading |
Map the wireframe to semantics
A wireframe annotation should describe purpose, state, and interaction. For example, annotate a “Save” control as: “Button. Keyboard activatable. Disabled while saving. Announces completion.”
The implementation might look like this:
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Profile settings</title>
</head>
<body>
<main>
<h1>Profile settings</h1>
<form>
<label for="display-name">Display name</label>
<input id="display-name" name="display-name" autocomplete="name">
<button type="submit">Save changes</button>
<p id="status" role="status" aria-live="polite"></p>
</form>
</main>
</body>
</html>The role="status" annotation tells assistive technology that changing text contains a status update. aria-live="polite" requests that the update wait until the user’s current announcement finishes.
Use ARIA carefully
ARIA attributes describe an element to assistive technology. They do not replace correct structure.
Common safe uses include:
aria-expanded="true"or"false"for a control that opens and closes content.aria-controls="panel-id"to identify the controlled region.aria-describedby="hint-id error-id"to connect supporting text.aria-invalid="true"when a submitted value fails validation.aria-current="page"for the current item in navigation.
Do not add role="button" to a link or generic container unless you also implement keyboard behavior, focus behavior, and the expected button interactions. In most cases, changing the element to <button> is safer.
Preserve names, states, and relationships
Every interactive control needs an accessible name. The name may come from visible text, a connected <label>, or a carefully chosen aria-label. Prefer visible text because it helps all users understand the control.
Annotate relationships explicitly:
- “This input’s visible label is Email address.”
- “This error appears after invalid submission and is linked to the input.”
- “This menu button exposes whether the menu is expanded.”
- “This dialog receives focus when opened and returns focus when closed.”
Handoff and review
Include these annotations in the wireframe:
- The intended HTML element or landmark.
- The accessible name and its source.
- Keyboard operations, including focus movement.
- State changes such as expanded, selected, busy, or invalid.
- Relationships between controls and content.
- Required announcements and error handling.
Review the semantic plan before visual design begins. A developer should be able to tell what each control is, what it does, and what users hear when its state changes.
Exercise
A wireframe shows a text link that opens a dialog containing account settings. Which semantic choices should the handoff specify?
Show answer
Use an <a> only if it navigates to a URL. If it opens the dialog as an action, use a <button>, give the dialog an accessible name, describe the button’s relationship to it, move focus into the dialog when it opens, and return focus to the button when it closes.