Use semantic controls and accessible names
Start with meaning, not ARIA
Accessibility means people can perceive, understand and operate an interface with different abilities and input methods. React creates browser elements, so begin with semantic HTML: a button performs an action, a link navigates, a heading names a section and a label identifies a field. Browsers expose roles, names, states and relationships through an accessibility tree used by assistive technologies. A visually attractive div does not acquire button behavior just because it has an onClick handler. Native controls provide much of that behavior already. This chapter uses React 19 as a proposed baseline; the examples are static source until run in an approved React application.
import React,{useState} from 'react';export default function TrailCard(){ const [saved,setSaved]=useState(false); return <article><h2>Birch trail</h2><p>Distance: 2 km</p> <a href="#trail-details">Read trail details</a> <button type="button" aria-pressed={saved} onClick={()=>setSaved(v=>!v)}>Save trail</button> <section id="trail-details"><h3>Trail details</h3><p>Level gravel path.</p></section> </article>;}The link moves to an existing section; the toggle button changes its pressed state while retaining its name. Tab reaches each native control; Enter activates links, and Space or Enter activates a focused button. Do not assign a positive tabIndex to reorder navigation. A screen reader can expose the pressed state, but exact speech depends on the browser and assistive technology. Keep the visible label stable for a pressed toggle. A visual icon alone needs an accessible name; a decorative icon next to text should not duplicate that text. Do not put focusable elements inside an aria-hidden subtree.
Associate each label and description
import React,{useId} from 'react';function Field({label,hint}){ const id=useId(); return <div><label htmlFor={id}>{label}</label> <input id={id} aria-describedby={id+'-hint'} /> <p id={id+'-hint'}>{hint}</p></div>;}export default function TrailFields(){return <><Field label="Trail name" hint="Use the name on the map."/><Field label="Meeting point" hint="Choose a public entrance."/></>;}Two field instances receive distinct IDs; the label supplies the name and aria-describedby supplies extra context. Clicking a label focuses its associated input. A placeholder is not a lasting label. aria-label can name a control without visible text, but prefer visible text where possible and keep the accessible name aligned with it. aria-labelledby references existing element IDs and can combine text; check that each target exists. useId is for relationships, not list keys. It requires compatible server and client trees when hydrating. Inspect the accessibility tree rather than guessing the computed name.
Give the page a navigable structure
import React from 'react';export default function TrailPage(){return <> <a className="skip-link" href="#main-content">Skip to content</a> <header><p>Trail guide</p><nav aria-label="Primary"><a href="#main-content">Trails</a> <a href="#contact">Contact</a></nav></header> <main id="main-content" tabIndex={-1}><h1>Local trails</h1><section><h2>Birch trail</h2><p>Level gravel path.</p></section></main> <footer id="contact"><p>Contact the trail desk.</p></footer></>;}This example is a standalone page shell, not the body heading hierarchy of a ByteMind lesson. It has a main landmark, a navigation landmark and a logical heading sequence. The skip link offers a way past repeated navigation. Keep it visible when focused; the target is focusable programmatically without an extra Tab stop. The companion stylesheet shows a visible focus style. Use native landmarks and label repeated navigation regions distinctly. Set the document language (for these English lessons, lang="en"); use language and direction attributes for mixed-language text when relevant. Logical CSS properties work with either direction; no translated lesson is required. Practice: inspect the names and heading order of the page and verify each native control by keyboard.