Small businesses—especially medical clinics, dental practices, and local service sites—get pitched $49 to $199/month "accessibility overlay" widgets constantly. Most of those scripts weigh 100 KB–300 KB+, phone home to vendor servers, clash with site CSS, break on client-side router transitions, and worst of all, sell misleading promises of "one-line ADA compliance."
When building custom hand-coded sites for clients at Leo Web Studio, I wanted visitors to have genuine display and reading controls without paying monthly overlay rent or hurting Core Web Vitals. So I packaged the lightweight Web Component we use in production and released it under the MIT license: @leowebstudio/accessibility-widget.
- Interactive live demo & docs (press
Alt + A): https://leowebstudio.com/tools/accessibility-widget - GitHub repository (MIT,
v1.0.0): https://github.com/leowebstudio/accessibility-widget
First: An Honest Accessibility Note
No overlay or widget makes a website ADA or WCAG 2.2 AA compliant on its own.
Real accessibility lives in your markup: semantic headings, valid ARIA attributes, checked contrast ratios, labeled form inputs, and full keyboard navigation. This widget is strictly a free, transparent companion layer on top of clean code—giving visitors with low vision, dyslexia, light sensitivity, or motion sensitivity quick, persistent display controls.
Quick Comparison: Open-Source Widget vs. Paid Overlays
| Criteria | @leowebstudio/accessibility-widget | Paid Overlays (e.g. AccessiBe, UserWay) |
|---|---|---|
| Cost | $0 forever (MIT) | $49–$199+/month recurring |
| Gzipped Size | 13.5 KB (+ 337 B anti-FOUC preload) | 100 KB–300 KB+ |
| Dependencies & Tracking | Zero (localStorage only) | Third-party cloud calls & analytics |
| Style Isolation | Shadow DOM (zero Tailwind/CSS clashes) | Global DOM style injections |
| Frameworks | Vanilla HTML, Astro View Transitions, React, Next.js | Generic script injection |
| White-Label Option | Built-in (data-hide-credit="true") | Paid tier required |
Four Engineering Details That Actually Matter
1. Zero-FOUC Preload (337 B gzipped)
If a visitor turns on High Contrast or +30% text size and navigates to another page, waiting for a deferred script creates an ugly flash of unstyled content. A tiny a11y-preload.min.js script in <head> reads localStorage (leo_a11y_prefs_v1) synchronously and restores data-leo-a11y-* attributes on <html> before first paint.
2. First-Class Astro View Transitions Support
Both the preload script and main Web Component listen to astro:after-swap and astro:page-load, re-applying saved attributes and ensuring <leo-a11y-widget> stays mounted cleanly across ClientRouter navigations.
3. Shadow DOM + Strict CSP Friendly
All UI styles live inside an isolated Shadow DOM so they never fight Tailwind, CSS modules, or custom design tokens—and no inline scripts are required, keeping strict Content Security Policies happy.
4. Built-In Controls (Zero External APIs)
- 3 presets: Vision (text +20%, high contrast, large cursor), Reading (legible fonts, WCAG 1.4.12 spacing, highlighted links), and Calm (paused animations + soft warm contrast)
- Granular toggles: 4 text-size steps (+10% to +40%), 3 WCAG 1.4.12 spacing steps, 3 contrast modes, desaturate, large white/black cursor, horizontal reading guide bar, and CSS + HTML5
<video>animation pause - Read Page (TTS): Uses the browser's native Web Speech API with previous/next paragraph controls and 4 playback speeds (
0.85x–1.5x) - Keyboard & widget coordination:
Alt + Aopens/closes the panel,Escapecloses it, and aleo-a11y:statecustom event lets you coordinate cleanly with a corner chat widget so the two never overlap.
Drop-In Usage
Vanilla HTML (jsDelivr CDN)
<head> <!-- Optional anti-FOUC preload (337 B gzipped) --> <script src="https://cdn.jsdelivr.net/gh/leowebstudio/accessibility-widget@v1.0.0/dist/a11y-preload.min.js"></script> </head> <body> <!-- Your content --> <!-- Main widget (13.5 KB gzipped) --> <script src="https://cdn.jsdelivr.net/gh/leowebstudio/accessibility-widget@v1.0.0/dist/a11y-widget.min.js" defer ></script> </body> Astro Layout
<head> <script is:inline src="/widgets/a11y-preload.min.js"></script> </head> <body> <slot /> <script is:inline src="/widgets/a11y-widget.min.js" defer></script> </body> Next.js (App Router)
import Script from 'next/script'; export default function RootLayout({ children }: { children: React.ReactNode }) { return ( <html lang="en"> <body> {children} <Script src="/widgets/a11y-preload.min.js" strategy="beforeInteractive" /> <Script src="/widgets/a11y-widget.min.js" strategy="afterInteractive" /> </body> </html> ); } White-Label & Dock Configuration
Add data-position="right" to change the default corner, or data-hide-credit="true" to hide the optional footer attribution link on client sites:
<script src="/widgets/a11y-widget.min.js" data-position="right" data-hide-credit="true" defer ></script> Try It Live
You can test every control live right now at leowebstudio.com/tools/accessibility-widget (press Alt + A), or grab the MIT source & minified builds on GitHub.
Feedback, bug reports, and edge cases from your own Astro / Next.js / static projects are very welcome!