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

@ -6,10 +6,10 @@
Dyslexia-friendly font every typeface becomes OpenDyslexic
(self-hosted, index.css)
Reading mode the page as plain text: one column of
ink on white, no colors, pictures,
cards or motion; a picture's
description stays in its place
Reading mode the page as text: its headings,
paragraphs, links and described
pictures in one column, nothing else
(ReaderView.tsx)
Color blind mode the palette swapped so its colors stay
apart for that type of color blindness,
or grays (color.ts, VISIONS)
@ -53,7 +53,7 @@ const SETTINGS = [
key: 'site-reading',
on: 'on',
label: 'Reading mode',
help: 'The page as plain text: one column, larger type, no colors, pictures or motion.',
help: 'The page as text: headings, paragraphs, links and pictures in one column, nothing else.',
},
] as const
@ -87,30 +87,6 @@ function apply(attribute: string, key: string, value: string | null) {
}
}
/* Reading mode hides pictures, video and maps; their descriptions
(alt, title, aria-label) go on the parent as data-reading-alt,
which index.css shows in their place. An attribute rather than a
new element, so React's own nodes are left alone. */
const DESCRIBED = 'main img[alt]:not([alt=""]), main iframe[title], main video[aria-label]'
function describeMedia() {
for (const el of document.querySelectorAll(DESCRIBED)) {
const words = el.getAttribute('alt') ?? el.getAttribute('title') ?? el.getAttribute('aria-label')
const kind = el.tagName === 'IMG' ? 'Image' : 'Video'
el.parentElement?.setAttribute('data-reading-alt', `${kind}: ${words}`)
}
}
function useMediaDescriptions(on: boolean) {
useEffect(() => {
if (!on) return undefined
describeMedia()
const observer = new MutationObserver(describeMedia)
observer.observe(document.body, { childList: true, subtree: true })
return () => observer.disconnect()
}, [on])
}
export default function AccessibilityPanel() {
const [open, setOpen] = useState(false)
const [state, setState] = useState(() => Object.fromEntries(SETTINGS.map((s) => [s.key, isOn(s)])))
@ -120,8 +96,6 @@ export default function AccessibilityPanel() {
const firstRef = useRef<HTMLButtonElement>(null)
const panelId = useId()
useMediaDescriptions(state['site-reading'])
useEffect(() => {
const root = document.documentElement
for (const { attribute, key } of PUBLIC_ONLY) {
@ -187,7 +161,7 @@ export default function AccessibilityPanel() {
id={panelId}
role="region"
aria-label="Accessibility"
className="reading-solid absolute right-0 bottom-full mb-3 w-[min(20rem,calc(100vw-2rem))] border border-brand/20 bg-raised p-4 shadow-xl"
className="absolute right-0 bottom-full mb-3 w-[min(20rem,calc(100vw-2rem))] border border-brand/20 bg-raised p-4 shadow-xl"
>
<div className="flex items-center justify-between gap-4">
<h2 className="font-display text-base font-bold text-ink">Accessibility</h2>

View file

@ -25,7 +25,7 @@ export default function Banner() {
if (!visible) return null;
const linkClass =
"underline underline-offset-4 decoration-[var(--green-2)] hover:text-white transition-colors";
"underline underline-offset-4 decoration-[var(--pal-green-2)] hover:text-white transition-colors";
return (
<div

View file

@ -28,14 +28,14 @@ const Footer_Links = [
];
const footerLinkClass =
"text-white/65 hover:text-[var(--green-2)] text-sm transition-colors";
"text-white/65 hover:text-[var(--pal-green-2)] text-sm transition-colors";
// inline-block with a little height of its own, so a finger can hit it.
const pageLinkClass =
"inline-block py-1 text-white/80 hover:text-[var(--green-2)] text-sm font-semibold transition-colors";
"inline-block py-1 text-white/80 hover:text-[var(--pal-green-2)] text-sm font-semibold transition-colors";
const sectionLinkClass =
"inline-block py-1 text-white/65 hover:text-[var(--green-2)] text-sm transition-colors";
"inline-block py-1 text-white/65 hover:text-[var(--pal-green-2)] text-sm transition-colors";
const headingClass = "text-white/90 text-sm font-semibold mb-4";

View file

@ -9,8 +9,10 @@ import Footer from "./Footer.tsx";
import PrivacyNotice from "./PrivacyNotice.tsx";
import PageBackdrop from "./PageBackdrop.tsx";
import AccessibilityPanel from "./AccessibilityPanel.tsx";
import ReaderView from "./ReaderView.tsx";
import ThemeToggle from "./ThemeToggle.tsx";
import { jumpTo } from "../lib/focus.ts";
import { useReadingMode } from "../lib/readingMode.ts";
/* ── Right-side nav actions ──────────────────────────────── */
@ -88,6 +90,9 @@ export default function Layout() {
const [dismissed, setDismissed] = useState<string | null>(null);
const location = useLocation();
const lastPath = useRef(location.pathname);
const reading = useReadingMode();
// The page itself, drawn hidden for the reader view to read.
const pageRef = useRef<HTMLDivElement>(null);
const sectionsOf = useNavSections();
@ -124,19 +129,20 @@ export default function Layout() {
);
ro.observe(el);
return () => ro.disconnect();
}, []);
}, [reading]);
// On the root, so anything can read it: index.css keeps focused
// and jumped-to things clear of the header with it
// (scroll-padding-top), and PostContents offsets by it.
useEffect(() => {
const root = document.documentElement;
root.style.setProperty("--header-h", `${headerHeight}px`);
// Reading mode has no header to stay clear of.
root.style.setProperty("--header-h", `${reading ? 0 : headerHeight}px`);
// The admin has no fixed header: nothing to stay clear of there.
return () => {
root.style.removeProperty("--header-h");
};
}, [headerHeight]);
}, [headerHeight, reading]);
// Router does not scroll on navigation. Go to top on a new page,
// or to the anchor if the URL carries one (handles deep links too).
@ -151,17 +157,42 @@ export default function Layout() {
if (newPage) document.getElementById("main")?.focus({ preventScroll: true });
}, [location.pathname, location.hash, location.key]);
const skipLink = (
<a
href="#main"
className="sr-only focus:not-sr-only focus:fixed focus:top-2 focus:left-2 focus:z-[70] focus:bg-surface focus:px-4 focus:py-2 focus:font-semibold focus:text-ink"
>
Skip to content
</a>
);
// Reading mode: the page as plain text (ReaderView.tsx), with no
// header, backdrop, footer or notices; the panel stays, to turn it
// off. The page itself still renders, hidden, for the reader to
// read, so every page works without a version of its own.
if (reading) {
return (
<div className="min-h-screen bg-surface text-ink">
{skipLink}
<main id="main" tabIndex={-1} className="outline-none">
<ReaderView source={pageRef} />
<div ref={pageRef} hidden>
<Suspense fallback={null}>
<Outlet />
</Suspense>
</div>
</main>
<AccessibilityPanel />
</div>
);
}
return (
// overflow-x-clip, not -hidden: hidden makes this div a scroll
// container, and then nothing inside it can be position: sticky
// (a blog post's contents column scrolled away with the page).
<div className="min-h-screen overflow-x-clip">
<a
href="#main"
className="sr-only focus:not-sr-only focus:fixed focus:top-2 focus:left-2 focus:z-[70] focus:bg-surface focus:px-4 focus:py-2 focus:font-semibold focus:text-ink"
>
Skip to content
</a>
{skipLink}
{/* ── NAV ─────────────────────────────────────────────── */}
<header
@ -177,7 +208,7 @@ export default function Layout() {
<nav
className="flex items-center justify-between px-6 py-4"
aria-label="Site"
style={{ background: "rgba(0, 58, 69, 0.92)" }}
style={{ background: "color-mix(in srgb, var(--pal-teal-1) 92%, transparent)" }}
>
<div className="flex items-center gap-8">
<Link to="/" aria-label="Next Generation of Unity home" className="inline-block">
@ -212,7 +243,7 @@ export default function Layout() {
className={({ isActive }) =>
`block text-base font-bold pb-1 border-b-2 transition-colors duration-200 ${
isActive
? "text-white border-[var(--green-2)]"
? "text-white border-[var(--pal-green-2)]"
: "text-white/75 hover:text-white border-transparent"
}`
}
@ -233,13 +264,13 @@ export default function Layout() {
>
<ul
className="min-w-56 py-2 shadow-xl"
style={{ background: "rgba(0, 16, 17, 0.97)", borderTop: "2px solid var(--green-2)" }}
style={{ background: "rgba(0, 16, 17, 0.97)", borderTop: "2px solid var(--pal-green-2)" }}
>
{pageSections.map((section) => (
<li key={section.hash}>
<Link
to={`${page.path}${section.hash}`}
className="block px-4 py-2 text-sm text-white/80 transition-colors hover:bg-white/10 hover:text-[#f0bd4f] focus-visible:bg-white/10"
className="block px-4 py-2 text-sm text-white/80 transition-colors hover:bg-white/10 hover:text-[var(--pal-amber-2)] focus-visible:bg-white/10"
>
{section.label}
</Link>
@ -299,8 +330,8 @@ export default function Layout() {
{/* Mobile menu */}
{mobileMenuOpen && (
<div
className="reading-solid fixed inset-0 z-[60] flex flex-col items-center [justify-content:safe_center] overflow-y-auto py-16"
style={{ background: "rgba(0, 58, 69, 0.97)" }}
className="fixed inset-0 z-[60] flex flex-col items-center [justify-content:safe_center] overflow-y-auto py-16"
style={{ background: "color-mix(in srgb, var(--pal-teal-1) 97%, transparent)" }}
role="dialog"
aria-modal="true"
aria-label="Menu"
@ -326,7 +357,7 @@ export default function Layout() {
end={page.path === "/"}
className={({ isActive }) =>
`block text-2xl font-bold py-3 transition-colors ${
isActive ? "text-[var(--green-2)]" : "text-white hover:text-[#f0bd4f]"
isActive ? "text-[var(--pal-green-2)]" : "text-white hover:text-[var(--pal-amber-2)]"
}`
}
>
@ -337,13 +368,13 @@ export default function Layout() {
{isActive && pageSections.length > 0 && (
<div
className="ml-3 pl-4 mb-2 flex flex-col"
style={{ borderLeft: "1px solid rgba(45,200,224,0.35)" }}
style={{ borderLeft: "1px solid color-mix(in srgb, var(--pal-teal-2) 35%, transparent)" }}
>
{pageSections.map((section) => (
<a
key={section.hash}
href={section.hash}
className="text-white/80 text-lg py-2 hover:text-[#f0bd4f] transition-colors"
className="text-white/80 text-lg py-2 hover:text-[var(--pal-amber-2)] transition-colors"
onClick={() => setMobileMenuOpen(false)}
>
{section.label}

View file

@ -18,10 +18,10 @@
pointer-events: none;
--pb-opacity: 0.6;
--pb-0: #d6f5fa;
--pb-1: var(--green-3);
--pb-2: #fdf1d6;
--pb-3: #d6f5fa;
--pb-0: var(--pal-teal-3);
--pb-1: var(--pal-green-3);
--pb-2: var(--pal-amber-3);
--pb-3: var(--pal-teal-3);
}
/* A circle's place: across by its left, down its layer's whole
@ -71,18 +71,18 @@
toggle's choice, or the system's when there is none. */
:root[data-theme="dark"] .page-backdrop {
--pb-opacity: 0.3;
--pb-0: #003a45;
--pb-1: var(--green-1);
--pb-2: #4a2e00;
--pb-3: #003a45;
--pb-0: var(--pal-teal-1);
--pb-1: var(--pal-green-1);
--pb-2: var(--pal-amber-1);
--pb-3: var(--pal-teal-1);
}
@media (prefers-color-scheme: dark) {
:root:not([data-theme="light"]) .page-backdrop {
--pb-opacity: 0.3;
--pb-0: #003a45;
--pb-1: var(--green-1);
--pb-2: #4a2e00;
--pb-3: #003a45;
--pb-0: var(--pal-teal-1);
--pb-1: var(--pal-green-1);
--pb-2: var(--pal-amber-1);
--pb-3: var(--pal-teal-1);
}
}

View file

@ -5,7 +5,7 @@
on the page backdrop (PageBackdrop.css). */
.side-nav-circle {
background: #d6f5fa;
background: var(--pal-teal-3);
/* A slight drop shadow, as the cards have: down and soft, no glow. */
box-shadow: 0 4px 12px rgb(0 16 17 / 0.14);
/* Color by section; size and place between centered on the list
@ -18,32 +18,32 @@
top 0.6s ease-in-out;
}
.side-nav-circle[data-family="green"] {
background: var(--green-3);
background: var(--pal-green-3);
}
.side-nav-circle[data-family="amber"] {
background: #fdf1d6;
background: var(--pal-amber-3);
}
/* Dark mode: the toggle's choice, or the system's when there is none. */
:root[data-theme="dark"] .side-nav-circle {
background: #003a45;
background: var(--pal-teal-1);
box-shadow: 0 4px 12px rgb(0 0 0 / 0.45);
}
:root[data-theme="dark"] .side-nav-circle[data-family="green"] {
background: var(--green-1);
background: var(--pal-green-1);
}
:root[data-theme="dark"] .side-nav-circle[data-family="amber"] {
background: #4a2e00;
background: var(--pal-amber-1);
}
@media (prefers-color-scheme: dark) {
:root:not([data-theme="light"]) .side-nav-circle {
background: #003a45;
background: var(--pal-teal-1);
box-shadow: 0 4px 12px rgb(0 0 0 / 0.45);
}
:root:not([data-theme="light"]) .side-nav-circle[data-family="green"] {
background: var(--green-1);
background: var(--pal-green-1);
}
:root:not([data-theme="light"]) .side-nav-circle[data-family="amber"] {
background: #4a2e00;
background: var(--pal-amber-1);
}
}

View file

@ -43,7 +43,7 @@ export default function PrivacyNotice() {
<div
role="region"
aria-label="Privacy notice"
className="reading-solid fixed bottom-20 left-4 right-4 z-40 sm:bottom-4 mx-auto max-w-md border border-brand/20 bg-surface p-4 text-sm text-body shadow-xl sm:right-auto"
className="fixed bottom-20 left-4 right-4 z-40 sm:bottom-4 mx-auto max-w-md border border-brand/20 bg-surface p-4 text-sm text-body shadow-xl sm:right-auto"
>
<p>
No tracking cookies here. Videos and maps come from YouTube, Facebook or Google only when you press

View file

@ -0,0 +1,217 @@
/* ═══════════════════════════════════════════════════════════════
READER VIEW: reading mode (AccessibilityPanel.tsx)
The page as text: its headings, paragraphs, links and pictures,
one column, nothing else. No buttons, cards, colors, carousels or
forms.
The real page still renders, hidden (Layout.tsx), so every page
and section works without a reading version of its own; this reads
what it drew and writes it out plainly, again whenever it changes
(data arriving, a new page).
What's kept:
h1 to h6 headings, at their level
p, li, td, quote... paragraphs, with their links
a links (a card that is one link gives its
heading the link)
img with alt text pictures; one with empty alt is decoration
(a card's faded background) and is left out
a button that opens its words, as a line: a person's tile, a
something schedule row (aria-expanded)
What's dropped: other buttons, form fields, navigation lists, video and
map frames, drawings, and anything hidden from screen readers
(aria-hidden, the copies a carousel draws for its turns).
═══════════════════════════════════════════════════════════════ */
import { useEffect, useState, type ReactNode, type RefObject } from 'react'
import { Link } from 'react-router-dom'
import { PAGE_LINKS } from '../navConfig.ts'
type Inline = string | { href: string; children: Inline[] }
type Block =
| { kind: 'heading'; level: number; content: Inline[] }
| { kind: 'text'; content: Inline[] }
| { kind: 'image'; src: string; alt: string }
const SKIP = new Set(['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEMPLATE', 'BUTTON', 'INPUT', 'SELECT', 'TEXTAREA', 'NAV', 'IFRAME', 'VIDEO', 'AUDIO', 'CANVAS', 'DIALOG', 'svg'])
const HEADINGS = new Set(['H1', 'H2', 'H3', 'H4', 'H5', 'H6'])
const TEXT_BLOCKS = new Set(['P', 'LI', 'DT', 'DD', 'BLOCKQUOTE', 'FIGCAPTION', 'CAPTION', 'ADDRESS', 'TH', 'TD'])
const BLOCK_SELECTOR = 'div,section,article,header,footer,aside,main,p,ul,ol,li,dl,dt,dd,table,tr,figure,blockquote,h1,h2,h3,h4,h5,h6,img,form,fieldset'
/* A button that opens something (a person's tile, a schedule row):
its words name content, so it's read as a line, not dropped. */
const opens = (el: Element) => el.tagName === 'BUTTON' && el.hasAttribute('aria-expanded')
const skipped = (el: Element) =>
(SKIP.has(el.tagName) && !opens(el)) ||
el.getAttribute('aria-hidden') === 'true' ||
el.hasAttribute('hidden') ||
['button', 'switch', 'tab', 'slider', 'presentation', 'none'].includes(el.getAttribute('role') ?? '')
/* A link's address as the app routes it: a path for this site, so
it opens without reloading; the full address for anywhere else. */
function hrefOf(a: HTMLAnchorElement): string | null {
const raw = a.getAttribute('href')
if (!raw || raw.startsWith('javascript:')) return null
try {
const url = new URL(raw, location.href)
return url.origin === location.origin ? url.pathname + url.search + url.hash : url.href
} catch {
return null
}
}
function inline(node: Node): Inline[] {
if (node.nodeType === Node.TEXT_NODE) return [node.textContent ?? '']
if (!(node instanceof Element) || skipped(node) || node.tagName === 'IMG') return []
if (node.tagName === 'BR') return [' ']
const children = [...node.childNodes].flatMap(inline)
if (node instanceof HTMLAnchorElement) {
const href = hrefOf(node)
return href ? [{ href, children }] : children
}
return children
}
const textOf = (parts: Inline[]): string =>
parts.map((p) => (typeof p === 'string' ? p : textOf(p.children))).join('').replace(/\s+/g, ' ').trim()
const isBlock = (el: Element) => opens(el) || el.matches(BLOCK_SELECTOR) || el.querySelector(BLOCK_SELECTOR) !== null
function extract(root: Element): Block[] {
const blocks: Block[] = []
const text = (content: Inline[]) => {
if (textOf(content)) blocks.push({ kind: 'text', content })
}
function walk(el: Element, link: string | null) {
// The root is the hidden copy of the page itself: read inside it.
if (el !== root && skipped(el)) return
if (opens(el)) {
// Each part on its own line in the page (a name, a title) joins
// with a comma.
const parts = [...el.querySelectorAll('*')]
.filter((part) => !part.closest('[aria-hidden="true"]') && [...part.childNodes].some((n) => n.nodeType === Node.TEXT_NODE && n.textContent?.trim()))
.map((part) => [...part.childNodes].filter((n) => n.nodeType === Node.TEXT_NODE).map((n) => n.textContent).join('').trim())
text([parts.join(', ')])
return
}
if (HEADINGS.has(el.tagName)) {
const content = [...el.childNodes].flatMap(inline)
if (textOf(content)) {
blocks.push({ kind: 'heading', level: Number(el.tagName[1]), content: link ? [{ href: link, children: content }] : content })
}
return
}
if (el.tagName === 'IMG') {
const img = el as HTMLImageElement
const alt = img.getAttribute('alt')?.trim()
const src = img.currentSrc || img.getAttribute('src')
if (alt && src) blocks.push({ kind: 'image', src, alt })
return
}
if (TEXT_BLOCKS.has(el.tagName) && !el.querySelector('p,li,h1,h2,h3,h4,h5,h6,img')) {
text([...el.childNodes].flatMap(inline))
return
}
if (el.tagName === 'TR') {
const cells = [...el.children].map((cell) => [...cell.childNodes].flatMap(inline)).filter((c) => textOf(c))
text(cells.flatMap((cell, i) => (i ? [' · ', ...cell] : cell)))
return
}
// A link around a whole card: its parts, with the link on the first
// heading (or, with none, kept as a line of its own).
const href = el instanceof HTMLAnchorElement ? hrefOf(el) : null
if (href && isBlock(el)) {
const before = blocks.length
for (const child of el.children) walk(child, href)
if (!blocks.slice(before).some((b) => b.kind === 'heading')) {
const label = el.getAttribute('aria-label')
if (label) blocks.splice(before, 0, { kind: 'text', content: [{ href, children: [label] }] })
}
return
}
// Anything else: its loose text and inline parts make paragraphs,
// broken where a block of its own comes.
let run: Inline[] = []
for (const child of el.childNodes) {
if (child instanceof Element && !skipped(child) && isBlock(child)) {
text(run)
run = []
walk(child, link)
} else {
run.push(...inline(child))
}
}
text(run)
}
walk(root, null)
// Carousels and repeated strips can say the same line twice in a row.
return blocks.filter((b, i) => {
const prev = blocks[i - 1]
return !prev || prev.kind !== b.kind || JSON.stringify(prev) !== JSON.stringify(b)
})
}
function render(parts: Inline[]): ReactNode[] {
return parts.map((part, i) => {
if (typeof part === 'string') return part
const children = render(part.children)
return part.href.startsWith('/') ? (
<Link key={i} to={part.href}>
{children}
</Link>
) : (
<a key={i} href={part.href}>
{children}
</a>
)
})
}
export default function ReaderView({ source }: { source: RefObject<HTMLElement | null> }) {
const [blocks, setBlocks] = useState<Block[]>([])
useEffect(() => {
const root = source.current
if (!root) return undefined
let frame = 0
const update = () => {
frame = 0
setBlocks(extract(root))
}
const schedule = () => {
if (!frame) frame = requestAnimationFrame(update)
}
update()
const observer = new MutationObserver(schedule)
observer.observe(root, { childList: true, subtree: true, characterData: true, attributes: true, attributeFilter: ['src', 'alt', 'href', 'hidden', 'aria-hidden'] })
return () => {
observer.disconnect()
if (frame) cancelAnimationFrame(frame)
}
}, [source])
return (
<article className="reader">
<p>
{PAGE_LINKS.map((page, i) => (
<span key={page.path}>
{i > 0 && ' · '}
<Link to={page.path}>{page.label}</Link>
</span>
))}
</p>
{blocks.map((block, i) => {
if (block.kind === 'image') return <img key={i} src={block.src} alt={block.alt} loading="lazy" />
if (block.kind === 'text') return <p key={i}>{render(block.content)}</p>
const Heading = `h${block.level}` as 'h1'
return <Heading key={i}>{render(block.content)}</Heading>
})}
</article>
)
}

View file

@ -90,7 +90,7 @@ export default function VideoPlayer({
className="block aspect-video w-full object-cover"
/>
) : (
<span className="block aspect-video w-full bg-[#003a45]" />
<span className="block aspect-video w-full bg-[var(--pal-teal-1)]" />
)}
<span
aria-hidden="true"

View file

@ -19,7 +19,6 @@
import { useEffect, useState } from "react";
import { jumpTo } from "../../lib/focus.ts";
import { scrollBehavior } from "../../lib/motion.ts";
import { accentText } from "../../lib/color.ts";
export type EditorSection = {
id: string;
@ -107,7 +106,11 @@ export function SectionNav({ sections, wrap = false }: { sections: EditorSection
type="button"
onClick={() => jumpTo(section.id)}
aria-current={lit ? "location" : undefined}
style={section.accent ? ({ "--nav-accent": accentText(section.accent) } as React.CSSProperties) : undefined}
style={
section.accent
? ({ "--nav-accent": `color-mix(in srgb, ${section.accent} var(--nav-text-mix), #ffffff)` } as React.CSSProperties)
: undefined
}
className={`-ml-px flex w-full items-center gap-1.5 border-l-2 px-3 py-1.5 text-left text-sm transition-colors ${
section.accent
? lit

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. */

View file

@ -61,17 +61,26 @@ export const STORED_PALETTE = {
<html data-vision> is set before the first paint (index.html)
and a change reloads the page, so it's read once here.
Simulated with the Machado (2009) matrices, the palette's green
and amber families blur together for protanopia and tritanopia,
so there green becomes violet, the same four shades at the same
contrasts (5.3:1 on white for the main one, 9:1 or better under
ink for the light ones). For deuteranopia the palette already
stays apart (violet or magenta would be worse), so it's kept.
In each of the three, a color an admin picked off the palette
snaps to the nearest palette color first, so two picked colors
can't land on one confusable pair. Monochrome is a grayscale
filter instead (index.css). The same swap for CSS is the
--green-* variables in index.css. */
Every color on the site is one of three color families (teal,
green, amber) or the gray ink. Seen with protanopia or
deuteranopia, colors fall on one blue to yellow line plus light
and dark; with tritanopia, on a red to cyan one. Three families at
one darkness can't all stay apart there, so each mode replaces all
three, at hues and darknesses picked by simulating the type (the
Machado 2009 matrices) to keep every pair, and each from the ink,
far apart for it and for typical vision too. The closest pair of
main or light shades, in CIELAB distance, goes from 11.4 to 27.9
(protanopia), 19.5 to 24.7 (deuteranopia) and 6.4 to 21.1
(tritanopia). Contrast holds: main shades 5.3:1 or more on white
and under white text, light shades 9:1 or more under ink, so the
theme tokens drawn from them (index.css) still read in both modes.
Each family keeps its role (teal is still the buttons and links).
A color an admin picked off the palette snaps to the nearest
palette shade first, so two picked colors can't land on one
confusable pair. Monochrome is a grayscale filter instead
(index.css). The same values for CSS are the --pal-* variables
in index.css. */
export const VISIONS = [
{ id: 'protanopia', label: 'Protanopia (red weak)' },
{ id: 'deuteranopia', label: 'Deuteranopia (green weak)' },
@ -79,11 +88,22 @@ export const VISIONS = [
{ id: 'monochrome', label: 'Monochrome' },
] as const
const VIOLET = ['#9839dc', '#4d1575', '#c9a5e3', '#f4eef9']
const SWAPS: Record<string, Partial<Record<keyof typeof STORED_PALETTE, string[]>>> = {
protanopia: { green: VIOLET },
deuteranopia: {},
tritanopia: { green: VIOLET },
protanopia: {
teal: ['#167c16', '#0b3c0b', '#55ca55', '#e3f5e3'],
green: ['#921a92', '#5b105b', '#e09ce0', '#f9edf9'],
amber: ['#603911', '#482a0d', '#d7ab7f', '#f7efe7'],
},
deuteranopia: {
teal: ['#3939dc', '#1b1b9b', '#aeaee6', '#f0f0fa'],
green: ['#11602b', '#0b3c1b', '#51c979', '#e1f5e7'],
amber: ['#627214', '#30370a', '#a7bd3b', '#eff3db'],
},
tritanopia: {
teal: ['#167a59', '#0a3b2a', '#4bc79e', '#e1f5ee'],
green: ['#a31d33', '#661220', '#e2a2ac', '#f9eef0'],
amber: ['#6f6f14', '#353509', '#b9b93a', '#f2f2d8'],
},
}
const vision = typeof document === 'undefined' ? undefined : document.documentElement.dataset.vision
@ -133,9 +153,9 @@ export const BRAND = 'var(--color-action)'
export const ACCENTS = {
teal: BRAND,
deep: '#003a45',
deep: visionColor('#003a45'),
green: visionColor('#4a7431'),
amber: '#8f5b00',
amber: visionColor('#8f5b00'),
}
/* A palette fill for something colored by its name, like the

15
src/lib/readingMode.ts Normal file
View file

@ -0,0 +1,15 @@
/* Whether the accessibility panel's reading mode is on: <html
data-reading="on">, set before the first paint (index.html) and by
the panel. A hook, so the layout redraws the moment it changes. */
import { useSyncExternalStore } from 'react'
const read = () => document.documentElement.dataset.reading === 'on'
function subscribe(onChange: () => void) {
const observer = new MutationObserver(onChange)
observer.observe(document.documentElement, { attributes: true, attributeFilter: ['data-reading'] })
return () => observer.disconnect()
}
export const useReadingMode = (): boolean => useSyncExternalStore(subscribe, read, () => false)

View file

@ -7,4 +7,4 @@
box or a build banner can read the same value later.
═══════════════════════════════════════════════════════════════ */
export const SITE_VERSION = "NGU-Web.v1.12.0-accessibility";
export const SITE_VERSION = "NGU-Web.v1.12.1-accessibility";

View file

@ -24,7 +24,7 @@ const PAGE = sitePage("/privacy");
'privacy', in Admin → Forms → Data requests.
═══════════════════════════════════════════════════════════════ */
const LAST_UPDATED = "September 30, 2026";
const LAST_UPDATED = "October 3, 2026";
const link = "underline underline-offset-2 text-link";
@ -137,11 +137,28 @@ const PARTS: LegalPart[] = [
id: "cookies",
heading: "Cookies and browser storage",
body: [
"This site doesn't use advertising or tracking cookies, and doesn't use Google Analytics. To see which pages are read, we use Plausible Analytics, which we host ourselves on our own server: it sets no cookies, doesn't follow you across sites, and keeps no personal information, only counts of visits to each page; nothing from it is shared or sold. The site also keeps a few small things in your own browser so it works the way you left it:",
<>
This site doesn't use advertising or tracking cookies, and doesn't use Google Analytics. To see which
pages are read, we use{" "}
<a href="https://plausible.io" className="text-link underline underline-offset-2">
Plausible Analytics
</a>
, which we host ourselves on our own server using its free, open-source{" "}
<a
href="https://github.com/plausible/community-edition/"
className="text-link underline underline-offset-2"
>
Community Edition
</a>
: it sets no cookies, doesn't follow you across sites, and keeps no personal information, only counts
of visits to each page; nothing from it is shared or sold. The site also keeps a few small things in
your own browser so it works the way you left it:
</>,
],
list: [
"That you closed the announcement banner or the privacy notice.",
"Whether you chose the light or dark look.",
"Your accessibility choices: the dyslexia-friendly font, reading mode and color blind mode.",
"For staff who sign in: a sign-in cookie that keeps you signed in, and a short-lived one used while signing in with Google.",
],
after: [

View file

@ -134,12 +134,12 @@ function Words({ hero, feature }: { hero: Hero; feature: HeroFeature }) {
</p>
) : feature === 'event' ? (
<p className="mb-6 inline-flex items-center gap-3 bg-white/10 px-4 py-1.5 text-sm font-semibold uppercase tracking-[0.2em] backdrop-blur">
<Star className="text-[#f0bd4f]" weight="fill" aria-hidden="true" />
<Star className="text-[var(--pal-amber-2)]" weight="fill" aria-hidden="true" />
Featured event
</p>
) : feature === 'video' ? (
<p className="mb-6 inline-flex items-center gap-3 bg-white/10 px-4 py-1.5 text-sm font-semibold uppercase tracking-[0.2em] backdrop-blur">
<Play className="text-[#f0bd4f]" weight="fill" aria-hidden="true" />
<Play className="text-[var(--pal-amber-2)]" weight="fill" aria-hidden="true" />
Featured video
{hero.video?.title && (
<span className="normal-case tracking-normal text-white/75">
@ -149,7 +149,7 @@ function Words({ hero, feature }: { hero: Hero; feature: HeroFeature }) {
</p>
) : (
hero.eyebrow && (
<p className="mb-6 inline-block border border-white/20 px-4 py-1.5 text-xs font-semibold uppercase tracking-[0.25em] text-[#f0bd4f]">
<p className="mb-6 inline-block border border-white/20 px-4 py-1.5 text-xs font-semibold uppercase tracking-[0.25em] text-[var(--pal-amber-2)]">
{hero.eyebrow}
</p>
)
@ -194,7 +194,7 @@ function Words({ hero, feature }: { hero: Hero; feature: HeroFeature }) {
labels side by side don't fit; the slash starts at sm (home.css,
.hp-split). One set: that one alone, in its own style. */
const PRIMARY_FILL = '#f0bd4f'
const PRIMARY_FILL = 'var(--pal-amber-2)'
const PRIMARY_TEXT = '#001011'
const HALF = 'relative flex items-center justify-center gap-2 px-8 py-4 text-lg transition-colors duration-200 focus-visible:outline-offset-[-6px]'
@ -244,7 +244,7 @@ function HeroActions({ primary, secondary }: { primary: HeroLink; secondary: Her
/* ── Brand backdrop ──────────────────────────────────────────── */
const BRAND_FILL = '#003a45'
const BRAND_FILL = 'var(--pal-teal-1)'
function BrandBackdrop() {
return (
@ -489,7 +489,7 @@ function EventPanel({ event }: { event: HeroEvent }) {
{event.title}
</Link>
</h2>
{event.theme && <p className="mt-1 text-lg font-semibold text-[#f0bd4f]">"{event.theme}"</p>}
{event.theme && <p className="mt-1 text-lg font-semibold text-[var(--pal-amber-2)]">"{event.theme}"</p>}
</div>
{(when || where) && (
@ -505,7 +505,7 @@ function EventPanel({ event }: { event: HeroEvent }) {
className={`inline-flex items-center gap-2 btn px-6 py-3 transition-transform hover:scale-105 ${
index === 0 ? 'text-[#001011]' : 'border border-white/35 text-white hover:bg-white/10'
}`}
style={index === 0 ? { background: '#f0bd4f' } : undefined}
style={index === 0 ? { background: 'var(--pal-amber-2)' } : undefined}
>
<PlatformIcon platform={link.platform} />
{link.label}

View file

@ -48,7 +48,7 @@ export default function StatsBand({ id, title, blurb, stats }: StatsBandProps) {
id={id}
ref={ref}
className="relative overflow-hidden py-24"
style={{ background: '#003a45' }}
style={{ background: 'var(--pal-teal-1)' }}
>
<div className="relative mx-auto max-w-6xl px-6">
<h2 className="font-display text-3xl font-bold text-white md:text-4xl">
@ -65,7 +65,7 @@ export default function StatsBand({ id, title, blurb, stats }: StatsBandProps) {
>
<dd className="font-display text-4xl font-extrabold leading-none text-white sm:text-5xl md:text-6xl">
<CountUp value={stat.value} run={seen} />
{stat.suffix && <span className="text-[#f0bd4f]">{stat.suffix}</span>}
{stat.suffix && <span className="text-[var(--pal-amber-2)]">{stat.suffix}</span>}
</dd>
<dt className="mt-3 text-sm font-semibold uppercase tracking-widest text-white/70">
{stat.label}