Accessibility: reader view and full palette swaps; version v1.12.1-accessibility

- Reading mode is now a reader view (ReaderView.tsx): the page renders
  hidden and its headings, paragraphs, links and described pictures
  are written out in one column, with no header, backdrop or footer.
- Color blind modes swap all three color families (teal, green,
  amber); palette hexes in components and CSS are now
  var(--pal-<family>-<shade>) so the modes reach them.
- CLAUDE.md and docs/updating-data-in-code.md describe both.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Zaldimmar 2026-10-03 16:10:57 -05:00
parent 420a8058b4
commit de17da7dc8
19 changed files with 507 additions and 192 deletions

View file

@ -58,6 +58,10 @@
accentText): all of it on light, half (the rest white) on dark. */
:root {
--accent-text-mix: 100%;
/* The side nav's lit label sits on its circle, the section's darkest
shade in dark mode, so it goes further toward white there (6.8:1
or better for every accent; 50% left the deep teal at 4.2:1). */
--nav-text-mix: 100%;
}
/* Dark mode: the visitor's system setting, unless the header toggle
@ -81,6 +85,7 @@
--color-danger-tint: #3b1714;
--color-raised: color-mix(in srgb, var(--color-tint) 35%, var(--color-surface));
--accent-text-mix: 50%;
--nav-text-mix: 30%;
color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
@ -99,6 +104,7 @@
--color-danger-tint: #3b1714;
--color-raised: color-mix(in srgb, var(--color-tint) 35%, var(--color-surface));
--accent-text-mix: 50%;
--nav-text-mix: 30%;
color-scheme: dark;
}
}
@ -250,13 +256,10 @@ iframe[src*="churchcenter"] {
font-family: 'OpenDyslexic', sans-serif;
}
/* Reading mode: the page as plain text. One narrow column of ink on
white (or the reverse in dark mode): no colors, backgrounds,
cards, shadows, borders, pictures, motion or decoration, larger
type and underlined links. A picture or video with a description
leaves it in its place (AccessibilityPanel.tsx copies it to
data-reading-alt on its parent). Unlayered, so it wins over the
admin's colors (theme.js, in layers). */
/* Reading mode: the page as text (ReaderView.tsx, which Layout.tsx
draws in place of the page). Two colors, ink on white or the
reverse in dark mode, unlayered so they win over the admin's
colors (theme.js, in layers); larger type in one column. */
:root[data-reading="on"] {
--color-ink: #111111;
--color-body: #111111;
@ -269,8 +272,6 @@ iframe[src*="churchcenter"] {
--color-tint: #ffffff;
--color-tint-soft: #ffffff;
--color-raised: #ffffff;
--color-danger: #111111;
--color-danger-tint: #ffffff;
--accent-text-mix: 100%;
font-size: 112.5%;
scroll-behavior: auto;
@ -287,8 +288,6 @@ iframe[src*="churchcenter"] {
--color-tint: #111111;
--color-tint-soft: #111111;
--color-raised: #111111;
--color-danger: #eeeeee;
--color-danger-tint: #111111;
}
@media (prefers-color-scheme: dark) {
:root[data-reading="on"]:not([data-theme="light"]) {
@ -303,86 +302,125 @@ iframe[src*="churchcenter"] {
--color-tint: #111111;
--color-tint-soft: #111111;
--color-raised: #111111;
--color-danger: #eeeeee;
--color-danger-tint: #111111;
}
}
/* Everything takes the page's two colors, inline styles included. */
:root[data-reading="on"] body * {
color: var(--color-ink) !important;
background-color: transparent !important;
background-image: none !important;
border-color: transparent !important;
box-shadow: none !important;
text-shadow: none !important;
filter: none !important;
mask-image: none !important;
-webkit-mask-image: none !important;
}
:root[data-reading="on"] body,
:root[data-reading="on"] header,
:root[data-reading="on"] .reading-solid {
background-color: var(--color-surface) !important;
}
:root[data-reading="on"] header {
border-bottom: 1px solid var(--color-muted) !important;
}
:root[data-reading="on"] *,
:root[data-reading="on"] *::before,
:root[data-reading="on"] *::after {
animation: none !important;
transition: none !important;
}
/* Pictures, video, maps and drawings go; the icons inside links and
buttons stay, in the text color, so an icon-only button keeps
its face. */
:root[data-reading="on"] main :is(img, picture, video, iframe, canvas, object),
:root[data-reading="on"] main svg:not(:is(a, button, label) svg),
:root[data-reading="on"] .page-backdrop,
:root[data-reading="on"] .notice::before,
:root[data-reading="on"] .notice::after {
display: none !important;
}
:root[data-reading="on"] [data-reading-alt]::after {
content: attr(data-reading-alt);
display: block;
margin-block: 0.5rem;
font-style: italic;
}
/* Controls keep an outline so they still read as controls. */
:root[data-reading="on"] :is(button, input, select, textarea, .btn) {
border: 1px solid var(--color-ink) !important;
}
:root[data-reading="on"] main {
.reader {
max-width: 42rem;
margin-inline: auto;
padding-inline: 1rem;
}
:root[data-reading="on"] main .grid {
grid-template-columns: minmax(0, 1fr) !important;
}
:root[data-reading="on"] main :is(p, li, dd) {
padding: 2.5rem 1rem 6rem;
line-height: 1.75;
}
:root[data-reading="on"] a {
text-decoration: underline !important;
.reader > * + * {
margin-top: 1rem;
}
.reader :is(h1, h2, h3, h4, h5, h6) {
margin-top: 2rem;
line-height: 1.3;
}
.reader h1 { font-size: 2rem; }
.reader h2 { font-size: 1.5rem; }
.reader h3 { font-size: 1.25rem; }
.reader :is(h4, h5, h6) { font-size: 1.1rem; }
.reader a {
text-decoration: underline;
text-underline-offset: 0.2em;
}
/* Color blind modes (data-vision, color.ts has the reasoning and the
same swap for colors set from code). The palette's green family
as variables, so CSS that uses it swaps too. */
:root {
--green-0: #4a7431;
--green-1: #23361a;
--green-2: #9cc47c;
--green-3: #e6f0dd;
.reader img {
display: block;
max-width: 100%;
height: auto;
}
:root:is([data-vision="protanopia"], [data-vision="tritanopia"]) {
--green-0: #9839dc;
--green-1: #4d1575;
--green-2: #c9a5e3;
--green-3: #f4eef9;
/* The palette's three color families as variables, [main, darkest,
light, lightest] as in color.ts, so CSS that draws in them follows
a color blind mode. Ink stays gray in every mode. */
:root {
--pal-teal-0: #00748a;
--pal-teal-1: #003a45;
--pal-teal-2: #5cd3e6;
--pal-teal-3: #d6f5fa;
--pal-green-0: #4a7431;
--pal-green-1: #23361a;
--pal-green-2: #9cc47c;
--pal-green-3: #e6f0dd;
--pal-amber-0: #8f5b00;
--pal-amber-1: #4a2e00;
--pal-amber-2: #f0bd4f;
--pal-amber-3: #fdf1d6;
}
/* Color blind modes (data-vision; color.ts has the reasoning and the
same values for colors set from code and data). Each mode replaces
all three families with ones that stay apart for that type, at the
same contrasts (main shades 5.3:1 or more on white, light ones 9:1
or more under ink), and the theme tokens below follow them. */
:root[data-vision="protanopia"] {
--pal-teal-0: #167c16;
--pal-teal-1: #0b3c0b;
--pal-teal-2: #55ca55;
--pal-teal-3: #e3f5e3;
--pal-green-0: #921a92;
--pal-green-1: #5b105b;
--pal-green-2: #e09ce0;
--pal-green-3: #f9edf9;
--pal-amber-0: #603911;
--pal-amber-1: #482a0d;
--pal-amber-2: #d7ab7f;
--pal-amber-3: #f7efe7;
}
:root[data-vision="deuteranopia"] {
--pal-teal-0: #3939dc;
--pal-teal-1: #1b1b9b;
--pal-teal-2: #aeaee6;
--pal-teal-3: #f0f0fa;
--pal-green-0: #11602b;
--pal-green-1: #0b3c1b;
--pal-green-2: #51c979;
--pal-green-3: #e1f5e7;
--pal-amber-0: #627214;
--pal-amber-1: #30370a;
--pal-amber-2: #a7bd3b;
--pal-amber-3: #eff3db;
}
:root[data-vision="tritanopia"] {
--pal-teal-0: #167a59;
--pal-teal-1: #0a3b2a;
--pal-teal-2: #4bc79e;
--pal-teal-3: #e1f5ee;
--pal-green-0: #a31d33;
--pal-green-1: #661220;
--pal-green-2: #e2a2ac;
--pal-green-3: #f9eef0;
--pal-amber-0: #6f6f14;
--pal-amber-1: #353509;
--pal-amber-2: #b9b93a;
--pal-amber-3: #f2f2d8;
}
/* The theme tokens drawn from the families, light and dark, as in
index.css's defaults. Not in reading mode, which has its own two
colors. Unlayered, so they win over the admin's colors. */
:root:is([data-vision="protanopia"], [data-vision="deuteranopia"], [data-vision="tritanopia"]):not([data-reading="on"]) {
--color-body: var(--pal-teal-1);
--color-link: var(--pal-teal-0);
--color-brand: var(--pal-teal-0);
--color-action: var(--pal-teal-0);
--color-action-hover: var(--pal-teal-1);
--color-tint: var(--pal-teal-3);
--color-tint-soft: color-mix(in srgb, var(--pal-teal-3) 50%, #f5f9f8);
}
:root:is([data-vision="protanopia"], [data-vision="deuteranopia"], [data-vision="tritanopia"]):not([data-reading="on"])[data-theme="dark"] {
--color-body: var(--pal-teal-3);
--color-link: var(--pal-teal-2);
--color-tint: var(--pal-teal-1);
--color-tint-soft: color-mix(in srgb, var(--pal-teal-1) 50%, #001011);
}
@media (prefers-color-scheme: dark) {
:root:is([data-vision="protanopia"], [data-vision="deuteranopia"], [data-vision="tritanopia"]):not([data-reading="on"]):not([data-theme="light"]) {
--color-body: var(--pal-teal-3);
--color-link: var(--pal-teal-2);
--color-tint: var(--pal-teal-1);
--color-tint-soft: color-mix(in srgb, var(--pal-teal-1) 50%, #001011);
}
}
/* Monochrome: the whole page in grays. On the root element a filter
leaves fixed elements (the header, the panel) where they were. */