Glossary / Semantic controls

Semantic controls

Semantic controls are native HTML elements whose role, state, keyboard behavior, focus behavior, and accessible name are understood by browsers and assistive technologies. A <button> is a button; an <a href> is a link; an <input> is a form control. Choosing the element that matches the action gives keyboard and assistive-technology behavior largely for free. A clickable <div> only looks interactive unless the developer recreates its semantics and behavior, which is error-prone.

What to know

Implementation and review

Prefer <button type="button">Save</button> for an action; set the type explicitly inside forms to avoid accidental submission. Prefer <a href="/settings">Settings</a> for navigation. Do not add role="button" to a native button; it is redundant. For custom controls, follow the WAI-ARIA Authoring Practices keyboard pattern and test with keyboard and target assistive technologies. Check that focus is visible, the control has an accessible name, state changes are announced or discoverable, and pointer activation has an equivalent keyboard operation.

Interview questions

  1. Why prefer native HTML to ARIA? Native elements already implement semantics and browser interaction; custom ARIA widgets require correct behavior and state synchronization.
  2. When is a link preferable to a button? When the main effect is navigation to a URL or fragment; buttons trigger an action.
  3. Does role="button" make a div behave like a button? No. It supplies a role, but the developer still needs focusability, Space/Enter activation, disabled behavior, and other expected behavior.
  4. What does a custom widget need? Correct role/name/state/value, keyboard and pointer operation, focus management, and reliable state exposure.
  5. How would you audit a design system? Inventory interactive components, replace fake controls with native elements where possible, define keyboard contracts, and test all states and input methods.

References