WAI-ARIA Implementation with Pure CSS Architecture
Here’s how the codebase implements key WAI-ARIA specifications using entirely CSS and semantic HTML, with no JavaScript dependencies:
1. Semantic HTML Foundation
Uses native form controls (
<input type="radio">) that have built-in accessibilityFieldset/Legend structure provides semantic grouping that screen readers understand natively
Pure CSS tab switching via
:checkedpseudo-class and sibling selectorsNo JavaScript required for any core functionality
2. ARIA Roles (Semantic Clarity)
role="radiogroup"on fieldset - accurately describes the selection mechanismrole="tabpanel"on content panels - correctly identifies them as switchable content viewsrole="region"on container - establishes it as a landmark for easy navigationCSS-only benefit: These roles are static HTML attributes that work universally
3. ARIA Relationships (Connected Experience)
aria-labelledbylinks panels to their controlling radiosaria-controlsconnects radios to their corresponding panels for screen reader syncaria-describedbyconnects radios to hidden descriptive textContainer’s
aria-labelledbypoints to the visible legendCSS-only benefit: All relationships defined in HTML, completely static and reliable
5. Screen Reader Announcements
Visible, meaningful legend announces the choice context
Hidden descriptions (
sr-only) provide additional context per optionStandard radio group announcements work through HTML structure alone
CSS-only benefit: Announcements work through semantic HTML without any scripting
6. Focus Management
tabindex="0"on panels makes them focusable after tab selectionVisual focus indicators via CSS
:focuspseudo-classBrowser handles all focus transitions using standard form behavior
CSS-only benefit: Focus management works without any custom JavaScript
7. Pure CSS Architecture Strategy
Implementation Layer (HTML/CSS only):
- Complete tab switching functionality
- Native keyboard navigation
- Full screen reader support
- Cross-browser compatibility
- No JavaScript dependencies
Benefits:
- Maximum compatibility (works everywhere CSS works)
- Better performance (no JS parsing/execution)
- Enhanced security (no script execution)
- Simplified maintenance (fewer moving parts)
8. Universal Compatibility
Without CSS: Content displays linearly with functional radio buttons
With CSS disabled: All content remains accessible in logical order
JavaScript disabled: Full functionality maintained (since none is used)
Restrictive environments: Works with strict Content Security Policies
Non-HTML output (LaTeX/PDF): Renders as readable sequential content
Design Philosophy
This implementation prioritizes robustness and universality over complex interactive patterns. The conscious design choice to use radiogroup semantics for tab-like behavior achieves:
Maximum reliability through standard form controls
Universal compatibility across all browsers and assistive technologies
Zero dependencies on JavaScript or complex CSS features
Predictable behavior that users already understand
The result is an accessible component that:
Works in every environment where HTML and CSS are supported
Provides consistent behavior across all platforms and assistive technologies
Requires no fallbacks or compatibility shims
Maintains perfect accessibility through semantic HTML structure
Offers better performance than JavaScript-dependent alternatives
Technical Implementation Details
CSS Selector Strategy: Uses data-tab-index attributes with CSS
[data-tab-index="N"]:checked selectors to show/hide panels, avoiding
fragile nth-child calculations.
Keyboard Navigation: Leverages browser’s native radiogroup keyboard handling, which already implements the correct ARIA patterns for grouped selection controls.
Screen Reader Compatibility: Relies on standard form semantics that all screen readers support consistently, rather than custom ARIA state management.
Focus Indicators: Uses CSS :focus and :focus-within to provide
clear visual feedback without requiring focus event handling.
This architecture demonstrates that accessible design often benefits from simplicity rather than complexity, achieving better compatibility through standard web technologies rather than custom implementations.