<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Leo Wang</title>
    <description>The latest articles on DEV Community by Leo Wang (@leowebstudio).</description>
    <link>https://dev.to/leowebstudio</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4285797%2Fb3042d02-2c3e-4f39-b2a6-3043a7c7ba2b.png</url>
      <title>DEV Community: Leo Wang</title>
      <link>https://dev.to/leowebstudio</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/leowebstudio"/>
    <language>en</language>
    <item>
      <title>I Open-Sourced a 13.5 KB Zero-Dependency Accessibility Widget (MIT, Built for Astro, Next.js &amp; Vanilla HTML)</title>
      <dc:creator>Leo Wang</dc:creator>
      <pubDate>Sun, 06 Dec 2026 05:00:48 +0000</pubDate>
      <link>https://dev.to/leowebstudio/i-open-sourced-a-135-kb-zero-dependency-accessibility-widget-mit-built-for-astro-nextjs--10pe</link>
      <guid>https://dev.to/leowebstudio/i-open-sourced-a-135-kb-zero-dependency-accessibility-widget-mit-built-for-astro-nextjs--10pe</guid>
      <description>&lt;p&gt;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."&lt;/p&gt;

&lt;p&gt;When building custom hand-coded sites for clients at &lt;a href="https://leowebstudio.com" rel="noopener noreferrer"&gt;Leo Web Studio&lt;/a&gt;, 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: &lt;strong&gt;&lt;code&gt;@leowebstudio/accessibility-widget&lt;/code&gt;&lt;/strong&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Interactive live demo &amp;amp; docs (press &lt;code&gt;Alt + A&lt;/code&gt;):&lt;/strong&gt; &lt;a href="https://leowebstudio.com/tools/accessibility-widget" rel="noopener noreferrer"&gt;https://leowebstudio.com/tools/accessibility-widget&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;GitHub repository (MIT, &lt;code&gt;v1.0.0&lt;/code&gt;):&lt;/strong&gt; &lt;a href="https://github.com/leowebstudio/accessibility-widget" rel="noopener noreferrer"&gt;https://github.com/leowebstudio/accessibility-widget&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  First: An Honest Accessibility Note
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;No overlay or widget makes a website ADA or WCAG 2.2 AA compliant on its own.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;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 &lt;strong&gt;free, transparent companion layer&lt;/strong&gt; on top of clean code—giving visitors with low vision, dyslexia, light sensitivity, or motion sensitivity quick, persistent display controls.&lt;/p&gt;




&lt;h2&gt;
  
  
  Quick Comparison: Open-Source Widget vs. Paid Overlays
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Criteria&lt;/th&gt;
&lt;th&gt;&lt;code&gt;@leowebstudio/accessibility-widget&lt;/code&gt;&lt;/th&gt;
&lt;th&gt;Paid Overlays (e.g. AccessiBe, UserWay)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Cost&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;$0 forever (MIT)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;$49–$199+/month recurring&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Gzipped Size&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;13.5 KB&lt;/strong&gt; (+ 337 B anti-FOUC preload)&lt;/td&gt;
&lt;td&gt;100 KB–300 KB+&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Dependencies &amp;amp; Tracking&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;Zero&lt;/strong&gt; (&lt;code&gt;localStorage&lt;/code&gt; only)&lt;/td&gt;
&lt;td&gt;Third-party cloud calls &amp;amp; analytics&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Style Isolation&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;Shadow DOM&lt;/strong&gt; (zero Tailwind/CSS clashes)&lt;/td&gt;
&lt;td&gt;Global DOM style injections&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Frameworks&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Vanilla HTML, Astro View Transitions, React, Next.js&lt;/td&gt;
&lt;td&gt;Generic script injection&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;White-Label Option&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Built-in (&lt;code&gt;data-hide-credit="true"&lt;/code&gt;)&lt;/td&gt;
&lt;td&gt;Paid tier required&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  Four Engineering Details That Actually Matter
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Zero-FOUC Preload (337 B gzipped)
&lt;/h3&gt;

&lt;p&gt;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 &lt;code&gt;a11y-preload.min.js&lt;/code&gt; script in &lt;code&gt;&amp;lt;head&amp;gt;&lt;/code&gt; reads &lt;code&gt;localStorage&lt;/code&gt; (&lt;code&gt;leo_a11y_prefs_v1&lt;/code&gt;) synchronously and restores &lt;code&gt;data-leo-a11y-*&lt;/code&gt; attributes on &lt;code&gt;&amp;lt;html&amp;gt;&lt;/code&gt; before first paint.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. First-Class Astro View Transitions Support
&lt;/h3&gt;

&lt;p&gt;Both the preload script and main Web Component listen to &lt;code&gt;astro:after-swap&lt;/code&gt; and &lt;code&gt;astro:page-load&lt;/code&gt;, re-applying saved attributes and ensuring &lt;code&gt;&amp;lt;leo-a11y-widget&amp;gt;&lt;/code&gt; stays mounted cleanly across &lt;code&gt;ClientRouter&lt;/code&gt; navigations.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Shadow DOM + Strict CSP Friendly
&lt;/h3&gt;

&lt;p&gt;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.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Built-In Controls (Zero External APIs)
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;3 presets:&lt;/strong&gt; &lt;em&gt;Vision&lt;/em&gt; (text +20%, high contrast, large cursor), &lt;em&gt;Reading&lt;/em&gt; (legible fonts, WCAG 1.4.12 spacing, highlighted links), and &lt;em&gt;Calm&lt;/em&gt; (paused animations + soft warm contrast)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Granular toggles:&lt;/strong&gt; 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 &lt;code&gt;&amp;lt;video&amp;gt;&lt;/code&gt; animation pause&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Read Page (TTS):&lt;/strong&gt; Uses the browser's native Web Speech API with previous/next paragraph controls and 4 playback speeds (&lt;code&gt;0.85x&lt;/code&gt;–&lt;code&gt;1.5x&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Keyboard &amp;amp; widget coordination:&lt;/strong&gt; &lt;code&gt;Alt + A&lt;/code&gt; opens/closes the panel, &lt;code&gt;Escape&lt;/code&gt; closes it, and a &lt;code&gt;leo-a11y:state&lt;/code&gt; custom event lets you coordinate cleanly with a corner chat widget so the two never overlap.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Drop-In Usage
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Vanilla HTML (jsDelivr CDN)
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;head&amp;gt;&lt;/span&gt;
  &lt;span class="c"&gt;&amp;lt;!-- Optional anti-FOUC preload (337 B gzipped) --&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;script&lt;/span&gt; &lt;span class="na"&gt;src&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"https://cdn.jsdelivr.net/gh/leowebstudio/accessibility-widget@v1.0.0/dist/a11y-preload.min.js"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/head&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;body&amp;gt;&lt;/span&gt;
  &lt;span class="c"&gt;&amp;lt;!-- Your content --&amp;gt;&lt;/span&gt;

  &lt;span class="c"&gt;&amp;lt;!-- Main widget (13.5 KB gzipped) --&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;script&lt;/span&gt;
    &lt;span class="na"&gt;src&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"https://cdn.jsdelivr.net/gh/leowebstudio/accessibility-widget@v1.0.0/dist/a11y-widget.min.js"&lt;/span&gt;
    &lt;span class="na"&gt;defer&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Astro Layout
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;head&amp;gt;
  &amp;lt;script is:inline src="/widgets/a11y-preload.min.js"&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
  &amp;lt;slot /&amp;gt;
  &amp;lt;script is:inline src="/widgets/a11y-widget.min.js" defer&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;/body&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Next.js (App Router)
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tsx"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nc"&gt;Script&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s1"&gt;'next/script'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nc"&gt;RootLayout&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;children&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;children&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;React&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;ReactNode&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;html&lt;/span&gt; &lt;span class="n"&gt;lang&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"en"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;body&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;children&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Script&lt;/span&gt; &lt;span class="n"&gt;src&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"/widgets/a11y-preload.min.js"&lt;/span&gt; &lt;span class="n"&gt;strategy&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"beforeInteractive"&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Script&lt;/span&gt; &lt;span class="n"&gt;src&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"/widgets/a11y-widget.min.js"&lt;/span&gt; &lt;span class="n"&gt;strategy&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"afterInteractive"&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="n"&gt;body&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="n"&gt;html&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  White-Label &amp;amp; Dock Configuration
&lt;/h3&gt;

&lt;p&gt;Add &lt;code&gt;data-position="right"&lt;/code&gt; to change the default corner, or &lt;code&gt;data-hide-credit="true"&lt;/code&gt; to hide the optional footer attribution link on client sites:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;script&lt;/span&gt;
  &lt;span class="na"&gt;src&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"/widgets/a11y-widget.min.js"&lt;/span&gt;
  &lt;span class="na"&gt;data-position&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"right"&lt;/span&gt;
  &lt;span class="na"&gt;data-hide-credit&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"true"&lt;/span&gt;
  &lt;span class="na"&gt;defer&lt;/span&gt;
&lt;span class="nt"&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Try It Live
&lt;/h2&gt;

&lt;p&gt;You can test every control live right now at &lt;strong&gt;&lt;a href="https://leowebstudio.com/tools/accessibility-widget" rel="noopener noreferrer"&gt;leowebstudio.com/tools/accessibility-widget&lt;/a&gt;&lt;/strong&gt; (press &lt;code&gt;Alt + A&lt;/code&gt;), or grab the MIT source &amp;amp; minified builds on &lt;strong&gt;&lt;a href="https://github.com/leowebstudio/accessibility-widget" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Feedback, bug reports, and edge cases from your own Astro / Next.js / static projects are very welcome!&lt;/p&gt;

</description>
      <category>opensource</category>
      <category>astro</category>
    </item>
  </channel>
</rss>
