React & Frontend8 min readAugust 31, 2026

Building Accessible (WCAG AA Compliant) UI Components in React from Scratch

How to build accessible modals, dropdowns, and tabs with full keyboard navigation, screen reader ARIA attributes, and focus trapping.

Nazmul Hawlader
Nazmul Hawlader
Senior Shopify & Full-Stack Engineer
Note: Key takeaways in this guide: • Implement keyboard navigation standards (Escape to close, Tab focus trapping, Arrow key selection). • Utilize ARIA live regions to announce dynamic updates to screen readers. • Ensure 4.5:1 color contrast ratios across dark and light UI themes.

Accessibility is not an afterthought or an optional checklist item; it is fundamental engineering quality. Building accessible components ensures your software can be navigated by anyone, regardless of physical ability or assistive device.

1. Managing Focus with Traps in Dialog Modals

When an accessible modal opens, focus must immediately shift inside the dialog, and tabbing must cycle strictly within the modal until dismissed. Pressing Escape must close the dialog and return focus to the trigger button.

Summary & Key Conclusion

Accessible software is inherently better software: cleaner HTML, predictable interactions, and higher user satisfaction.

Nazmul Hawlader

Written by Nazmul Hawlader

Top Rated

Senior Full-Stack Engineer & Official Shopify App Store developer. Founder of Stockly and Kilo (kilo.nazmulcodes.org), specializing in high-performance Shopify apps, client-side media compression, and sub-second web performance.

Recommended Related Articles