Your Sunday, upgraded. Free live AI class · 5 PM ISTReserve your seat
FRONTEND & UX

Accessible Components in Practice: Buttons, Forms, Dialogs and Menus

Most accessibility problems on learning sites come from a handful of components. This guide explains how to build the common ones so they work with a keyboard, a screen reader and zoom, using native HTML wherever possible.

On this page

Start with native elements

Native HTML elements come with keyboard support, focus handling and meaning for assistive technology built in. A button can be focused, activated with Enter or Space and is announced as a button. A div styled to look like a button has none of that unless you rebuild it. The first accessibility rule for components is therefore to use button for actions, a with href for navigation, and real form controls for input. ARIA attributes are for filling gaps that HTML cannot express, not for replacing native elements.

Forms

Every input needs a programmatically associated label, usually a label element with a for attribute matching the input's id. Placeholder text is not a label: it disappears while typing and often has poor contrast. Group related controls, such as radio buttons, with fieldset and legend.

When validation fails, show errors next to the relevant field in text, connect them with aria-describedby and move focus to an error summary or the first invalid field on submit. Do not rely on colour alone to indicate errors, and keep the user's input so they can correct it rather than retype it.

Dialogs

A modal dialog must take focus when it opens, keep focus inside while open, close with the Escape key and return focus to the element that opened it. It needs an accessible name from its heading. The native dialog element opened with showModal() provides much of this behaviour, including making the rest of the page inert. If you build a custom dialog, you must implement each part yourself and test it with a screen reader.

Content and zoom

  • Use headings in a logical order so screen-reader users can navigate by heading.
  • Provide alternative text that describes the purpose of informative images, and empty alt for decorative ones.
  • Ensure text contrast meets WCAG AA: 4.5:1 for normal text and 3:1 for large text.
  • Check that pages work at 200% zoom and on narrow screens without horizontal scrolling for text.
  • Respect prefers-reduced-motion for animations.

Test like a user

Automated tools catch some issues, such as missing labels and low contrast, but not whether an interaction makes sense. Complete key tasks using only the keyboard, then with a screen reader such as NVDA, VoiceOver or TalkBack, and at high zoom. Fix the barriers that stop a task first.

Checklist

  • Native elements are used for actions, links and inputs
  • Every control has an accessible name and visible focus
  • Form errors are textual, associated and focusable
  • Dialogs manage, trap and restore focus
  • Navigation uses simple disclosure patterns
  • Key tasks are tested with keyboard, screen reader and zoom

Share or cite this guide

Innovate with Ajay Editorial (2026-10-07). Accessible Components in Practice: Buttons, Forms, Dialogs and Menus. https://innovatewithajay.com/articles/accessible-components-checklist

Editorial approach, sources and corrections

YOUR NEXT CHAPTER

You have the curiosity.
Let’s turn it into capability.

Start with a practical workshop or bring a specific question to Ajay.

Chat with Ajay