Coconut Design System v3.11.0
home Home

Accessibility

The Coconut Design System is built with accessibility as a core principle. Every component is designed to be perceivable, operable, understandable, and robust for all users, including those who rely on assistive technologies.

WCAG Compliance

Target: WCAG 2.1 Level AA

The Web Content Accessibility Guidelines (WCAG) 2.1 is the international standard for web accessibility. It defines how to make web content more accessible to people with disabilities, including blindness, low vision, deafness, hearing loss, limited movement, speech disabilities, photosensitivity, and cognitive limitations. The Coconut Design System targets Level AA conformance, which covers the most common barriers for the widest range of users.

info WCAG is organized around four principles known as POUR: Perceivable, Operable, Understandable, and Robust. Every component in this system is evaluated against these principles.
Conformance Levels Explained
LevelDescriptionRequirementsStatus
A Minimum Text alternatives for images, keyboard navigable, no seizure-inducing content, basic page structure Compliant
AA Recommended Color contrast ≥ 4.5:1 for text, resizable text up to 200%, visible focus indicators, consistent navigation, error identification Compliant
AAA Enhanced Color contrast ≥ 7:1, sign language for multimedia, extended audio descriptions, no timing limits Partial
Key Success Criteria We Address
check_circle
1.4.3 Contrast (Minimum)
All text meets 4.5:1 contrast ratio against its background
check_circle
2.1.1 Keyboard
All functionality available from a keyboard
check_circle
2.4.7 Focus Visible
Keyboard focus indicator is always visible
check_circle
4.1.2 Name, Role, Value
Components expose proper name, role, and state to assistive tech

Color Contrast

All text colors meet or exceed WCAG AA contrast requirements

WCAG 2.1 requires a contrast ratio of at least 4.5:1 for normal text and 3:1 for large text (18px+ bold or 24px+ regular). A ratio of 7:1 or higher achieves AAA level. Every color combination in the design system has been tested to ensure readability.

Light Mode Contrast Ratios
ForegroundBackgroundSampleRatioLevel
--gray-900 #1b1b1f --white #ffffff
Aa
15.4:1 AAA
--muted #616568 --white #ffffff
Aa
5.2:1 AA
--accent #744F28 --white #ffffff
Aa
6.5:1 AA
--red #ba1a1a --white #ffffff
Aa
5.7:1 AA
Dark Mode Contrast Ratios
ForegroundBackgroundSampleRatioLevel
--text #ffffff --bg #020617
Aa
19.3:1 AAA
--muted #94a3b8 --bg #020617
Aa
5.8:1 AA
Visual Contrast Swatches
Primary Text
#1b1b1f on #fff 15.4:1
Accent Link
#744F28 on #fff 6.5:1
Muted Text
#616568 on #fff 5.2:1
Dark Primary
#fff on #020617 19.3:1
Dark Muted
#94a3b8 on #020617 5.8:1
Dark Accent
#C4956A on #020617 9.1:1

Focus States

All interactive elements have visible focus indicators

Every interactive element in the design system displays a clearly visible focus ring when navigated to via keyboard. The standard focus style uses a 2px solid accent-colored outline with 1px offset, ensuring it does not overlap the element content and remains visible on all backgrounds.

Focused Link
/* Global focus style for all interactive elements */ :focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; } /* Remove default outline for mouse users */ :focus:not(:focus-visible) { outline: none; } /* Enhanced focus for dark mode */ body.dark :focus-visible { outline-color: #C4956A; }
warning Never remove outlines without providing an alternative focus indicator. Using outline: none without a replacement makes your interface unusable for keyboard-only users.

Keyboard Navigation

Complete keyboard operability for all components

Every interactive element in the Coconut Design System is reachable and operable with a keyboard alone. The tab order follows a logical, predictable sequence through the page structure.

Tab Order Sequence
1 Skip Link
arrow_forward
2 Topbar Actions
arrow_forward
3 Sidebar Links
arrow_forward
4 Main Content
Component Keyboard Interactions
ComponentKeyAction
All interactive Tab Move focus to next element
All interactive Shift+Tab Move focus to previous element
Button / Link Enter Activate the button or follow the link
Button Space Activate the button
Accordion Enter / Space Toggle accordion panel open/closed
Toggle Switch Space Toggle switch on/off
Modal Escape Close the modal and return focus to trigger
Modal Tab Cycle focus within modal (focus trap)
Tabs Arrow Left/Right Navigate between tab items
Focus Trap Pattern for Modals

When a modal is open, focus must be trapped inside it. Pressing Tab on the last focusable element loops back to the first, and vice versa.

function trapFocus(modal) { const focusable = modal.querySelectorAll( 'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])' ); const first = focusable[0]; const last = focusable[focusable.length - 1]; modal.addEventListener('keydown', (e) => { if (e.key !== 'Tab') return; if (e.shiftKey && document.activeElement === first) { e.preventDefault(); last.focus(); } else if (!e.shiftKey && document.activeElement === last) { e.preventDefault(); first.focus(); } }); first.focus(); }

ARIA Patterns

Proper use of ARIA attributes across components

ARIA (Accessible Rich Internet Applications) attributes provide extra semantic information to assistive technologies. Use them to communicate state, relationships, and purpose that HTML alone cannot convey. Follow the first rule of ARIA: do not use ARIA if native HTML can do the job.

Component ARIA Reference
ComponentAttributesPurpose
Accordion role="button"
aria-expanded="true|false"
aria-controls="panel-id"
Communicates expandable state to screen readers
Toast / Alert role="alert"
aria-live="assertive"
Announces dynamic notifications immediately
Modal role="dialog"
aria-modal="true"
aria-labelledby="title-id"
Identifies modal and labels it for assistive tech
Toggle Switch role="switch"
aria-checked="true|false"
aria-label="Feature name"
Communicates on/off state
Tabs role="tablist" on container
role="tab" on each tab
role="tabpanel" on panels
aria-selected="true"
Establishes tab-panel relationship
Icons (decorative) aria-hidden="true" Hides decorative icons from screen readers
Progress Bar role="progressbar"
aria-valuenow="45"
aria-valuemin="0"
aria-valuemax="100"
Conveys current progress percentage
Navigation aria-label="Main navigation"
aria-current="page"
Labels navigation landmark and current page
Accordion ARIA Example
<!-- Accessible Accordion --> <div class="accordion-header" role="button" tabindex="0" aria-expanded="false" aria-controls="panel-1"> <span class="accordion-title">Section Title</span> <span class="accordion-arrow" aria-hidden="true">expand_more</span> </div> <div id="panel-1" class="accordion-body" role="region" aria-labelledby="header-1"> Panel content here. </div>
Toast / Live Region Example
<!-- Live region for toast notifications --> <div class="toast-container" role="alert" aria-live="assertive" aria-atomic="true"> Settings saved successfully. </div> <!-- For less urgent updates, use polite --> <div aria-live="polite"> 3 new items loaded. </div>
Decorative Icon with aria-hidden
<!-- Decorative icon — hidden from screen readers --> <span class="material-symbols-outlined" aria-hidden="true">settings</span> <!-- Icon-only button — needs aria-label --> <button aria-label="Open settings"> <span class="material-symbols-outlined" aria-hidden="true">settings</span> </button>

Reduced Motion

Respecting user motion preferences

Some users experience motion sickness, vertigo, or migraines from animated content. The prefers-reduced-motion media query detects whether the user has requested minimal animations through their operating system settings. All animations and transitions in the Coconut Design System respect this preference.

info On macOS: System Preferences → Accessibility → Display → Reduce motion. On Windows: Settings → Accessibility → Visual Effects → Animation effects (off).
/* Disable all transitions and animations when user prefers reduced motion */ @media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; } } /* Or selectively disable specific animations */ @media (prefers-reduced-motion: reduce) { .badge-dot { animation: none; /* Stop pulsing dot */ } .card:hover { transform: none; /* No hover lift */ } .docs-sidebar { transition: none; /* No slide animation */ } }
JavaScript Detection

You can also detect the preference in JavaScript for more complex animation logic:

const prefersReducedMotion = window.matchMedia( '(prefers-reduced-motion: reduce)' ); if (prefersReducedMotion.matches) { // Skip animations, use instant transitions chart.update({ animation: false }); } // Listen for changes (user toggles preference live) prefersReducedMotion.addEventListener('change', (e) => { if (e.matches) { disableAnimations(); } else { enableAnimations(); } });

Screen Reader Best Practices

Semantic HTML and assistive technology support

Screen readers interpret the DOM and communicate structure, content, and interactive elements to users. Using semantic HTML is the most effective way to ensure compatibility. The Coconut Design System recommends these practices for all implementations.

Use Semantic Landmarks

Landmarks allow screen reader users to jump between major sections of a page. Use them consistently across all pages.

<!-- Correct landmark structure --> <header class="docs-topbar">...</header> <nav class="docs-sidebar" aria-label="Main navigation">...</nav> <main id="main-content">...</main> <footer class="docs-footer">...</footer> <!-- Avoid generic divs for structural elements --> <!-- Bad: <div class="header"> --> <!-- Good: <header> -->
Image Alt Text Guidelines
check_circle
Informative images
Provide descriptive alt text: <img alt="Server rack with 12 units occupied">
check_circle
Decorative images
Use empty alt: <img alt="" role="presentation">
check_circle
Charts and data visualizations
Provide a text summary: <img alt="Line chart showing 12% revenue growth over Q3">
Visually Hidden Text (sr-only)

Sometimes you need text that is read by screen readers but not visible on screen. Use the .sr-only utility class instead of display: none or visibility: hidden, which hide content from assistive tech too.

/* Visually hide but keep accessible to screen readers */ .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; } <!-- Usage example --> <button class="btn btn-red"> <span class="material-symbols-outlined" aria-hidden="true">delete</span> <span class="sr-only">Delete item</span> </button>
Heading Hierarchy

Screen reader users navigate by headings. Always maintain a logical heading hierarchy without skipping levels.

h1
Page Title
h2
Section Title
h3
Subsection
h2
Next Section
error Do not skip heading levels. Going from h1 directly to h4 breaks the document outline and confuses screen reader navigation.

Touch Targets

Minimum 44 x 44px interactive area on mobile

WCAG 2.5.5 (AAA) and the Apple Human Interface Guidelines recommend a minimum touch target size of 44 x 44 pixels. This ensures that users with limited dexterity or those using assistive devices can reliably tap interactive elements. All Coconut Design System components are designed to meet this minimum.

Component Touch Target Analysis
ComponentVisual SizeEffective Touch AreaMeets 44px
Button (.btn) padding: 8px 20px Height: ~36px (font 0.78rem + 16px padding). Add min-height: 44px on mobile. Yes
Sidebar Link height: 36px Height 36px + padding within the row. The spacing between links provides combined 44px area. Yes
Toggle Switch 44px x 24px Width meets minimum. Height boosted to 44px via touch area padding. Yes
Checkbox / Radio 18px x 18px Label wraps the input, extending the clickable area to full row width. Yes
Icon Button 30px x 30px Padding extended on mobile via min-width: 44px; min-height: 44px. Yes
Visual Touch Target Demo
44px
dashboard Dashboard
44px
44px
/* Ensure minimum touch target on mobile */ @media (max-width: 900px) { .btn { min-height: 44px; min-width: 44px; } .theme-toggle, .docs-hamburger { min-width: 44px; min-height: 44px; } .docs-sidebar-link { min-height: 44px; } }

Accessibility Checklist

Quick reference for developers building with the Coconut Design System
check_box All images have descriptive alt text (or alt="" if decorative)
check_box Color contrast meets WCAG AA (4.5:1 for normal text, 3:1 for large text)
check_box All interactive elements are keyboard accessible with visible focus states
check_box Page uses semantic HTML landmarks (header, nav, main, footer)
check_box Heading levels are sequential and not skipped (h1 → h2 → h3)
check_box Form fields have associated <label> elements or aria-label
check_box Dynamic content uses aria-live regions for screen reader announcements
check_box Animations respect prefers-reduced-motion media query
check_box Modals trap focus and close on Escape
check_box Touch targets are at least 44 x 44px on mobile devices

Testing Tools

Recommended tools for accessibility auditing
extension
axe DevTools
Browser extension for automated a11y testing
speed
Lighthouse
Built into Chrome DevTools, includes a11y audit
contrast
Colour Contrast Analyser
Desktop app for checking color contrast ratios
record_voice_over
VoiceOver / NVDA
Manual screen reader testing (macOS / Windows)