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:
Zaldimmar 2026-09-30 22:34:40 -05:00
parent 0f62b67ee0
commit 177a65005e
7 changed files with 243 additions and 2 deletions

View file

@ -5,6 +5,8 @@
@import '@fontsource/poppins/600.css';
@import '@fontsource/poppins/700.css';
@import '@fontsource/poppins/800.css'; /* the front page's stat numbers only */
@import '@fontsource/opendyslexic/400.css'; /* the accessibility panel's font, */
@import '@fontsource/opendyslexic/700.css'; /* only downloaded when chosen */
@import 'tailwindcss';
@ -209,6 +211,62 @@ iframe[src*="churchcenter"] {
--btn-radius: 0.5rem;
}
/* ── Accessibility choices (AccessibilityPanel.tsx) ──────────────
Set on <html> before the first paint (index.html) and by the
panel. */
/* Dyslexia-friendly font: every typeface, headings and buttons too. */
:root[data-font="dyslexic"] {
--font-display: 'OpenDyslexic', sans-serif;
--font-body: 'OpenDyslexic', sans-serif;
}
:root[data-font="dyslexic"] body,
:root[data-font="dyslexic"] h1,
:root[data-font="dyslexic"] h2,
:root[data-font="dyslexic"] h3,
:root[data-font="dyslexic"] h4,
:root[data-font="dyslexic"] h5,
:root[data-font="dyslexic"] h6,
:root[data-font="dyslexic"] button,
:root[data-font="dyslexic"] input,
:root[data-font="dyslexic"] textarea,
:root[data-font="dyslexic"] select {
font-family: 'OpenDyslexic', sans-serif;
}
/* Reading mode: the same content with the design stepped back. No
background circles, motion or shadows; every layout one column,
narrower and larger, with plain underlined links. */
:root[data-reading="on"] {
font-size: 112.5%;
scroll-behavior: auto;
}
:root[data-reading="on"] .page-backdrop {
display: none;
}
:root[data-reading="on"] *,
:root[data-reading="on"] *::before,
:root[data-reading="on"] *::after {
animation: none !important;
transition: none !important;
box-shadow: none !important;
}
:root[data-reading="on"] main {
max-width: 48rem;
margin-inline: auto;
}
:root[data-reading="on"] main .grid {
grid-template-columns: minmax(0, 1fr) !important;
}
:root[data-reading="on"] main p,
:root[data-reading="on"] main li {
line-height: 1.75;
}
:root[data-reading="on"] main a {
text-decoration: underline;
text-underline-offset: 0.2em;
}
/* A notice where content would be (an empty section, a form's
note, "coming soon"): no box and no fill, just two thick brackets
at opposite corners, top left and bottom right, like a