An accessibility button: a dyslexia-friendly font and a reading mode
A button fixed to the bottom right of every public page opens two switches. Dyslexia-friendly font swaps every typeface for OpenDyslexic (self-hosted, @fontsource/opendyslexic, downloaded only when chosen). Reading mode steps the design back: no background circles, motion or shadows, every layout one column, larger text and underlined links. Both are data attributes on <html>, remembered in the browser and set before the first paint like the theme. On a phone the privacy notice sits above the button. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
0f62b67ee0
commit
177a65005e
7 changed files with 243 additions and 2 deletions
|
|
@ -9,7 +9,8 @@
|
|||
<meta name="theme-color" content="#073d4a" media="(prefers-color-scheme: light)" />
|
||||
<meta name="theme-color" content="#0c1d21" media="(prefers-color-scheme: dark)" />
|
||||
<!-- Theme before first paint, so a dark visitor never sees a white
|
||||
flash: this browser's choice (ThemeToggle), else the system. -->
|
||||
flash: this browser's choice (ThemeToggle), else the system;
|
||||
and the accessibility choices, for the same reason. -->
|
||||
<script>
|
||||
try {
|
||||
// Once: browser keys used to start "ngu-"; move them to "site-"
|
||||
|
|
@ -25,6 +26,9 @@
|
|||
var t = localStorage.getItem("site-theme");
|
||||
document.documentElement.dataset.theme =
|
||||
t === "dark" || t === "light" ? t : matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
||||
// The accessibility panel's choices (AccessibilityPanel.tsx).
|
||||
if (localStorage.getItem("site-font") === "dyslexic") document.documentElement.dataset.font = "dyslexic";
|
||||
if (localStorage.getItem("site-reading") === "on") document.documentElement.dataset.reading = "on";
|
||||
} catch (e) {}
|
||||
</script>
|
||||
<!-- site:head-end -->
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue