Accessibility: reading and color blind modes, audit fixes, calendar window

- Accessibility panel: the switch knob stays in its track; the panel
  follows its button in the Tab order and opens on its first switch.
- Reading mode is the page as plain text: one column, no colors,
  pictures, cards or motion; descriptions stay in place.
- Color blind mode (protanopia, deuteranopia, tritanopia, monochrome):
  palette swaps chosen by simulation, applied to code, data and CSS
  colors on public pages only. The newsletter uses the stored palette.
- Audit fixes: focus not hidden by the header, focus on page change
  and in-page jumps, focus return for the menu, day list and people
  details, labelled admin fields and dialogs, keyboard map tiles,
  scrollable tables, and more.
- Calendar asks /events for its six weeks only (?from=&to=); carousels
  take their 12 most recent past events (?past=12).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Zaldimmar 2026-10-02 14:33:09 -05:00
parent d067c02d33
commit b816203c0c
45 changed files with 760 additions and 208 deletions

View file

@ -24,7 +24,7 @@ import { useSitePage, type SitePageSection } from '../lib/useSitePages.ts'
import { useHistory } from '../lib/useHistory.ts'
import { HISTORY_DECADES } from '../data/historyDecades.ts'
import { ACCENTS, BRAND } from '../lib/color.ts'
import { scrollBehavior } from '../lib/motion.ts'
import { jumpTo } from '../lib/focus.ts'
import OrgListMap, { OrgMapToggle } from './sections/OrgList-Map.tsx'
import OrgListVertical from './sections/OrgList-Vertical.tsx'
import OrgListCards from './sections/OrgList-Card.tsx'
@ -113,7 +113,7 @@ function Sections({ title, intro, sections }: { title: string; intro?: string; s
// sections have loaded; this does it again once they're here.
const { hash } = useLocation()
useEffect(() => {
if (hash) document.getElementById(decodeURIComponent(hash.slice(1)))?.scrollIntoView({ behavior: scrollBehavior() })
if (hash) jumpTo(decodeURIComponent(hash.slice(1)))
}, [hash])
const manifest = useSectionManifest(

View file

@ -464,6 +464,7 @@ export default function AdminClips() {
value={url}
onChange={(e) => setUrl(e.target.value)}
placeholder="https://www.youtube.com/watch?v=…"
aria-label="Video link"
className={`min-w-0 flex-1 ${input}`}
/>
<button type="submit" className={primary} disabled={adding || !url.trim()}>

View file

@ -391,6 +391,7 @@ function FeedbackCard({ row, onChange, onRemove, canWrite, canRemove }) {
value={note}
disabled={busy}
placeholder="Internal note: who's handling it, what was done"
aria-label="Internal note"
onChange={(e) => setNote(e.target.value)}
className="mt-3 w-full resize-y border border-muted/25 bg-surface px-3 py-2 text-sm text-body outline-none focus:border-brand focus:ring-2 focus:ring-brand/25"
/>
@ -611,6 +612,7 @@ export default function AdminFeedback({ kind = "feedback" }: { kind?: keyof type
type="search"
value={query}
placeholder="Search messages"
aria-label="Search messages"
onChange={(e) => setQuery(e.target.value)}
onKeyDown={(e) => {
if (e.key === "Enter") setSearch(query.trim());

View file

@ -304,6 +304,7 @@ function FilesTab() {
value={query}
onChange={(e) => setQuery(e.target.value)}
placeholder="Search by file name"
aria-label="Search by file name"
className="ml-auto w-64 border border-muted/25 px-3 py-2 text-sm outline-none focus:border-brand"
/>
</div>
@ -548,6 +549,7 @@ export default function AdminMedia() {
value={query}
onChange={(e) => setQuery(e.target.value)}
placeholder="Search by file name"
aria-label="Search by file name"
className="ml-auto w-64 border border-muted/25 px-3 py-2 text-sm outline-none focus:border-brand"
/>
</div>

View file

@ -38,7 +38,7 @@ import { mediaUrl } from '../../lib/media.ts'
import { SITE_NAME, SITE_ORIGIN, siteUrl } from '../../lib/site.ts'
import { seriesLabel } from '../../lib/eventSeries.ts'
import { useWideAdminPage } from '../../lib/adminWidth.tsx'
import { PALETTE } from '../../lib/color.ts'
import { STORED_PALETTE } from '../../lib/color.ts'
import { PLATFORMS } from '../../lib/platforms.ts'
import { SOCIAL_LINKS } from '../../data/socialLinks.ts'
import {
@ -81,9 +81,10 @@ const PART_TYPES: Array<[string, string, string]> = [
]
const partLabel = (type: string) => PART_TYPES.find(([value]) => value === type)?.[1] ?? type
/* The site's palette as choices; an inbox needs the hex itself. */
/* The site's palette as choices; an inbox needs the hex itself, and
the one stored, not a color blind mode's swap (color.ts). */
const SHADES = ['', ', darkest', ', light', ', lightest']
const PALETTE_OPTIONS = Object.entries(PALETTE).flatMap(([family, shades]) =>
const PALETTE_OPTIONS = Object.entries(STORED_PALETTE).flatMap(([family, shades]) =>
shades.map((hex, i) => [hex, `${family[0].toUpperCase()}${family.slice(1)}${SHADES[i]}`]),
)
const colorField = (path: string, label: string, fallback: string, none: string, types: string[]) => ({

View file

@ -378,6 +378,7 @@ export default function AdminPanel() {
value={row.role}
disabled={locked || busy || fromGroup}
onChange={(e) => changeRole(row, e.target.value)}
aria-label={`Role for ${row.name || row.email}`}
className="border border-brand/30 bg-surface px-2 py-1 text-sm text-ink disabled:cursor-not-allowed disabled:bg-tint-soft disabled:text-muted/60"
title={
fromGroup

View file

@ -149,6 +149,7 @@ export default function EntityList() {
type="search"
value={query}
placeholder="Search"
aria-label="Search"
onChange={(e) => setQuery(e.target.value)}
onKeyDown={(e) => e.key === "Enter" && setParam("q", query.trim())}
className="border border-muted/25 bg-surface px-4 py-1.5 text-sm text-body outline-none focus:border-brand"

View file

@ -3,7 +3,9 @@
Every published event on a month grid, or as a list of the month.
Self contained like EventListCards: give it a filter and it
fetches, so it can sit on any page.
fetches, so it can sit on any page. It asks only for the six
weeks on screen (eventData.ts, from/to), so paging months costs
one small request each, not the whole history up front.
<EventCalendar /> everything
<EventCalendar host="northwest" /> one host's calendar
@ -40,7 +42,7 @@
═══════════════════════════════════════════════════════════════ */
import { ArrowRight, ArrowLeft, CaretRight, CaretLeft } from '@phosphor-icons/react'
import { useMemo, useState, type ReactNode } from 'react'
import { useEffect, useMemo, useRef, useState, type ReactNode } from 'react'
import { Link } from 'react-router-dom'
import { typesPresent, useEvents } from '../../lib/eventData.ts'
@ -232,10 +234,24 @@ export default function EventCalendar({
controls = ALL_CONTROLS,
defaultView = 'month',
}: EventCalendarProps) {
const { events: pinned, scopes, loading, error } = useEvents({ scope, host, status, type })
const today = iso(new Date())
const [month, setMonth] = useState(monthKey(today))
// Only the six weeks on screen come from the server; the last
// month's events stay up while the next month's arrive.
const weeks = useMemo(() => gridFor(month), [month])
const gridFrom = weeks[0][0]
const gridTo = weeks[5][6]
const monthFrom = `${month}-01`
const monthTo = addDays(`${shiftMonth(month, 1)}-01`, -1)
const { events: pinned, scopes, ready, loading, error } = useEvents({
scope,
host,
status,
type,
from: gridFrom,
to: gridTo,
})
const [view, setView] = useState<CalendarView>(defaultView)
const [selected, setSelected] = useState<string | null>(null)
@ -248,40 +264,38 @@ export default function EventCalendar({
const showScope = show('scope') && !scope
const showType = show('type') && !type
const types = useMemo(() => typesPresent(pinned, EVENT_TYPES), [pinned])
// What this window holds, plus whatever is picked, so a choice
// doesn't vanish from its own dropdown on a quieter month.
const types = useMemo(
() => EVENT_TYPES.filter((t) => t.id === kind || typesPresent(pinned, [t]).length > 0),
[pinned, kind],
)
const scopeOptions = useMemo(() => {
const present = new Set(pinned.map((e) => e.scope_id))
return scopes.filter((s) => present.has(s.id))
}, [pinned, scopes])
return scopes.filter((s) => present.has(s.id) || s.id === pickedScope)
}, [pinned, scopes, pickedScope])
const events = useMemo(() => {
const needle = query.trim().toLowerCase()
return pinned.filter((e) => {
if (pickedScope && e.scope_id !== pickedScope) return false
if (kind && e.event_type !== kind) return false
if (onlineOnly && !e.is_online) return false
if (needle) {
const haystack = [
e.title,
e.theme,
e.location_label,
e.locality,
...(e.hosts ?? []).map((h) => h.name),
]
.filter(Boolean)
.join(' ')
.toLowerCase()
if (!haystack.includes(needle)) return false
}
return true
})
}, [pinned, pickedScope, kind, onlineOnly, query])
const weeks = useMemo(() => gridFor(month), [month])
const gridFrom = weeks[0][0]
const gridTo = weeks[5][6]
const monthFrom = `${month}-01`
const monthTo = addDays(`${shiftMonth(month, 1)}-01`, -1)
const needle = query.trim().toLowerCase()
const matches = (e: EventListItem) => {
if (pickedScope && e.scope_id !== pickedScope) return false
if (kind && e.event_type !== kind) return false
if (onlineOnly && !e.is_online) return false
if (needle) {
const haystack = [
e.title,
e.theme,
e.location_label,
e.locality,
...(e.hosts ?? []).map((h) => h.name),
]
.filter(Boolean)
.join(' ')
.toLowerCase()
if (!haystack.includes(needle)) return false
}
return true
}
const events = useMemo(() => pinned.filter(matches), [pinned, pickedScope, kind, onlineOnly, needle])
const occurrences = useMemo(
() => occurrencesIn(events, gridFrom, gridTo),
@ -290,7 +304,13 @@ export default function EventCalendar({
const inMonth = occurrences.filter((o) => o.end >= monthFrom && o.start <= monthTo)
const undated = events.filter((e) => !e.starts_on).length
const filtering = Boolean(pickedScope || kind || onlineOnly || query)
const next = inMonth.length === 0 ? nextDateAfter(events, monthTo) : null
// An empty month offers a jump to the next event, so then (and only
// then) everything from the month's end on is fetched to find it.
const { events: later } = useEvents(
ready && !loading && inMonth.length === 0 ? { scope, host, status, type, from: addDays(monthTo, 1) } : null,
)
const next = inMonth.length === 0 ? nextDateAfter(later.filter(matches), monthTo) : null
const onDay = (date: string) => occurrences.filter((o) => o.start <= date && o.end >= date)
@ -421,7 +441,7 @@ export default function EventCalendar({
<p className="bg-surface p-6 text-danger">
Couldn’t load events. {error.message}
</p>
) : loading ? (
) : !ready ? (
<div className="h-[32rem] animate-pulse bg-tint" aria-hidden="true" />
) : (
<>
@ -532,6 +552,7 @@ function MonthGrid({ weeks, month, today, occurrences, selected, onSelect, accen
key={date}
type="button"
onClick={() => onSelect(date)}
data-calendar-day={date}
aria-pressed={isSelected}
aria-label={`${longDay(date)}${count ? `, ${count} event${count === 1 ? '' : 's'}` : ''}`}
className="relative flex flex-col items-start border-r border-brand/10 p-2 text-left transition-colors last:border-r-0 hover:bg-tint-soft"
@ -596,6 +617,7 @@ function Bar({ seg, accent }: { seg: Segment; accent: string }) {
>
{seg.continuesBefore && <ArrowLeft size="1em" weight="bold" className="inline align-[-0.125em]" aria-hidden="true" />}
<span className="truncate">
{canceled && <span className="sr-only">Canceled: </span>}
{seg.time && seg.span === 1 && <span className="font-normal opacity-85">{seg.time.split(' – ')[0]} </span>}
{seg.event.title}
</span>
@ -621,13 +643,28 @@ function DayPanel({
accent: string
onClose: () => void
}) {
// Opening a day takes focus to its list, which sits below the
// whole grid; closing it takes focus back to the day.
const panelRef = useRef<HTMLDivElement>(null)
const headingRef = useRef<HTMLHeadingElement>(null)
useEffect(() => {
headingRef.current?.focus()
}, [date])
const close = () => {
const day = panelRef.current?.parentElement?.querySelector<HTMLElement>(`[data-calendar-day="${date}"]`)
onClose()
day?.focus()
}
return (
<div className="mt-4 border bg-surface p-6" style={{ borderColor: `${withAlpha(accent, 25)}`}}>
<div ref={panelRef} className="mt-4 border bg-surface p-6" style={{ borderColor: `${withAlpha(accent, 25)}`}}>
<div className="flex items-center gap-4">
<h4 className="font-display text-lg font-bold">{longDay(date)}</h4>
<h4 ref={headingRef} tabIndex={-1} className="font-display text-lg font-bold outline-none">
{longDay(date)}
</h4>
<button
type="button"
onClick={onClose}
onClick={close}
className="ml-auto text-sm font-semibold hover:underline"
style={{ color: accentText(accent) }}
>

View file

@ -86,6 +86,11 @@ const PAST_PEEK = "10rem";
const PAST_PAGE = 12;
const PAST_FADE = "linear-gradient(to bottom, black 0%, black 45%, transparent 100%)";
/* How far back the carousel goes: its most recent past events only
(the server leaves the rest out). The grid's past list pages
through them all. */
const CAROUSEL_PAST = 12;
/* ── Carousel sizing ──────────────────────────────────────────
CARD the card itself
GAP space between cards, raise to push neighbors out
@ -458,6 +463,7 @@ export default function EventListCards({
host,
status,
type,
past: view === "carousel" ? CAROUSEL_PAST : undefined,
});
const cardColor = defaultColor ?? accent;
@ -511,7 +517,8 @@ export default function EventListCards({
setIndex(first === -1 ? events.length - 1 : first);
}, [events]);
// Grid view splits the list; the carousel still shows everything.
// Grid view splits the list; the carousel shows it all (the
// upcoming ones and its CAROUSEL_PAST most recent past ones).
// The list comes oldest first; the past grid reads newest first.
const { upcoming, past } = splitByStatus(events);
const pastEvents = past.reverse();
@ -719,18 +726,18 @@ export default function EventListCards({
<>
<button
onClick={prev}
disabled={index === 0}
aria-disabled={index === 0}
aria-label="Previous event"
className="absolute left-2 md:left-6 top-1/2 -translate-y-1/2 z-10 h-12 w-12 btn hidden sm:flex items-center justify-center text-2xl shadow-lg transition-all duration-200 hover:scale-110 disabled:hover:scale-100"
className="absolute left-2 md:left-6 top-1/2 -translate-y-1/2 z-10 h-12 w-12 btn hidden sm:flex items-center justify-center text-2xl shadow-lg transition-all duration-200 hover:scale-110 aria-disabled:hover:scale-100"
style={arrowStyle(index > 0)}
>
<CaretLeft size={20} weight="bold" aria-hidden="true" />
</button>
<button
onClick={next}
disabled={index === events.length - 1}
aria-disabled={index === events.length - 1}
aria-label="Next event"
className="absolute right-2 md:right-6 top-1/2 -translate-y-1/2 z-10 h-12 w-12 btn hidden sm:flex items-center justify-center text-2xl shadow-lg transition-all duration-200 hover:scale-110 disabled:hover:scale-100"
className="absolute right-2 md:right-6 top-1/2 -translate-y-1/2 z-10 h-12 w-12 btn hidden sm:flex items-center justify-center text-2xl shadow-lg transition-all duration-200 hover:scale-110 aria-disabled:hover:scale-100"
style={arrowStyle(index < events.length - 1)}
>
<CaretRight size={20} weight="bold" aria-hidden="true" />
@ -745,7 +752,7 @@ export default function EventListCards({
so they move down here, beside the dots. */}
<button
onClick={prev}
disabled={index === 0}
aria-disabled={index === 0}
aria-label="Previous event"
className="btn flex h-10 w-10 items-center justify-center sm:hidden"
style={arrowStyle(index > 0)}
@ -776,7 +783,7 @@ export default function EventListCards({
))}
<button
onClick={next}
disabled={index === events.length - 1}
aria-disabled={index === events.length - 1}
aria-label="Next event"
className="btn flex h-10 w-10 items-center justify-center sm:hidden"
style={arrowStyle(index < events.length - 1)}

View file

@ -22,6 +22,7 @@ import { PAGE_LINKS } from "../../navConfig.ts";
import { useNavSections, type NavSection } from "../../lib/navSections.ts";
import { DATA_REQUEST, FEEDBACK_TYPES } from "../../data/feedbackTypes.ts";
import { accentText, BRAND } from '../../lib/color.ts'
import { focusOnMount } from '../../lib/focus.ts'
const MUTED = "var(--color-muted)";
const MAX_CHARS = 1500;
@ -112,6 +113,7 @@ export function TilePicker({
options,
value,
onChange,
error,
}: {
legend: string;
blurb: string;
@ -119,9 +121,12 @@ export function TilePicker({
options: { id: string; label: string; hint: string }[];
value: string | null;
onChange: (id: string) => void;
/** Shown under the tiles and read with each one. */
error?: string;
}) {
const errorId = `${name}-error`;
return (
<fieldset>
<fieldset aria-describedby={error ? errorId : undefined}>
<legend className="text-base font-semibold text-body">{legend}</legend>
<p className="mt-1 text-sm" style={{ color: MUTED }}>
{blurb}
@ -138,6 +143,8 @@ export function TilePicker({
value={type.id}
checked={selected}
onChange={() => onChange(type.id)}
aria-invalid={Boolean(error)}
aria-describedby={error ? errorId : undefined}
className="peer sr-only"
/>
<span
@ -169,6 +176,7 @@ export function TilePicker({
);
})}
</div>
<FieldError id={errorId}>{error}</FieldError>
</fieldset>
);
}
@ -318,7 +326,12 @@ export default function FeedbackForm({ fixedType }: { fixedType?: string } = {})
aria-live="polite"
className="border border-brand/20 bg-surface p-8 sm:p-10"
>
<h3 className="text-2xl font-bold" style={{ color: accentText(BRAND) }}>
<h3
ref={focusOnMount}
tabIndex={-1}
className="text-2xl font-bold outline-none"
style={{ color: accentText(BRAND) }}
>
Thanks, we've got it
</h3>
{where && (

View file

@ -181,17 +181,35 @@ function Tile({
setSelected(at === ids.length - 1 ? null : ids[at + 1]);
};
const name = `${AREA_NAMES[code] || code}: ${slices.map(s => s.name).join(" / ")}${
count ? ` · ${count} group${count > 1 ? "s" : ""}` : ""
}`;
// A tile with groups is a button for the keyboard too (Enter or
// Space, as a click); the empty ones stay out of the Tab order,
// which would otherwise cross every state.
return (
<g
onClick={cycle}
onMouseEnter={() => setHovered(primary.regionId)}
onMouseLeave={() => setHovered(null)}
{...(count
? {
role: "button",
tabIndex: 0,
"aria-label": name,
onFocus: () => setHovered(primary.regionId),
onBlur: () => setHovered(null),
onKeyDown: (e) => {
if (e.key !== "Enter" && e.key !== " ") return;
e.preventDefault();
cycle();
},
}
: {})}
style={{ cursor: "pointer" }}
>
<title>
{AREA_NAMES[code] || code}: {slices.map(s => s.name).join(" / ")}
{count ? ` · ${count} group${count > 1 ? "s" : ""}` : ""}
</title>
<title>{name}</title>
<clipPath id={clipId}>
<rect x={x} y={y} width={width} height={size} />

View file

@ -23,6 +23,7 @@ import { accentText, BRAND } from "../../lib/color.ts";
import { REQUEST_FILES } from "../../lib/site.ts";
import { REQUEST_TYPES, type RequestAction } from "../../data/requestTypes.ts";
import { FieldError, MinimumNote, OptionalTag, RequiredTag, TilePicker, errorFieldClass, fieldClass } from "./FeedbackForm.tsx";
import { focusOnMount } from "../../lib/focus.ts";
const MUTED = "var(--color-muted)";
const MAX_CHARS = 5000;
@ -137,7 +138,12 @@ export default function RequestForm() {
if (status === "sent") {
return (
<div aria-live="polite" className="border border-brand/20 bg-surface p-8 sm:p-10">
<h3 className="text-2xl font-bold" style={{ color: accentText(BRAND) }}>
<h3
ref={focusOnMount}
tabIndex={-1}
className="text-2xl font-bold outline-none"
style={{ color: accentText(BRAND) }}
>
Thanks, we've got it
</h3>
<p className="mt-3 max-w-prose" style={{ color: MUTED }}>
@ -163,11 +169,11 @@ export default function RequestForm() {
options={REQUEST_TYPES}
value={category}
onChange={pick}
error={fieldErrors.category}
/>
<FieldError id="request-category-error">{fieldErrors.category}</FieldError>
{type && type.actions.length > 1 && (
<fieldset className="mt-8">
<fieldset className="mt-8" aria-describedby={fieldErrors.action ? "request-action-error" : undefined}>
<legend className="text-base font-semibold text-body">New, or an update?</legend>
<div className="mt-3 flex flex-wrap gap-3">
{type.actions.map((a) => (
@ -178,6 +184,8 @@ export default function RequestForm() {
value={a}
checked={action === a}
onChange={() => setAction(a)}
aria-invalid={Boolean(fieldErrors.action)}
aria-describedby={fieldErrors.action ? "request-action-error" : undefined}
className="peer sr-only"
/>
<span
@ -214,6 +222,7 @@ export default function RequestForm() {
maxLength={200}
value={subject}
onChange={(e) => setSubject(e.target.value)}
aria-required="true"
aria-invalid={Boolean(fieldErrors.subject)}
aria-describedby={fieldErrors.subject ? "request-subject-error" : undefined}
className={`mt-3 ${fieldClass} ${fieldErrors.subject ? errorFieldClass : ""}`}
@ -283,6 +292,7 @@ export default function RequestForm() {
? "What's there now, and what it should say instead."
: (PLACEHOLDER[type.id] ?? "Everything we'd need to add it: a description, links, and who to contact.")
}
aria-required="true"
aria-invalid={Boolean(fieldErrors.message)}
aria-describedby={fieldErrors.message ? "request-message-error" : undefined}
className={`mt-3 resize-y ${fieldClass} ${fieldErrors.message ? errorFieldClass : ""}`}

View file

@ -45,6 +45,8 @@ import DoveMark from '../../../components/DoveMark.tsx'
import PlatformIcon from '../../../components/PlatformIcon.tsx'
import { livestreamEmbedUrl, videoSource, type VideoSource } from '../../../lib/embeds.ts'
import { mediaUrl } from '../../../lib/media.ts'
import { prefersLessMotion } from '../../../lib/motion.ts'
import { focusOnMount } from '../../../lib/focus.ts'
import { eventHref } from '../../../lib/hrefs.ts'
import { seriesLabel } from '../../../lib/eventSeries.ts'
import type { Hero, HeroBackdrop, HeroEvent, HeroFeature, HeroSlide } from '../../../lib/useFrontPage.ts'
@ -263,7 +265,8 @@ function BrandBackdrop() {
function PhotoBackdrop({ slides, seconds }: { slides: HeroSlide[]; seconds: number }) {
const [index, setIndex] = useState(0)
const [paused, setPaused] = useState(false)
// Starts paused for anyone who asked for less motion; Play is there.
const [paused, setPaused] = useState(prefersLessMotion)
const ms = Math.max(3, seconds) * 1000
const current = slides[index % slides.length]
@ -370,6 +373,7 @@ function LiveFrame({ src, url, title }: { src: string | null; url: string; title
<div className="aspect-video w-full">
{src && watching ? (
<iframe
ref={focusOnMount}
src={src}
title={title || 'Livestream'}
className="h-full w-full"

View file

@ -93,7 +93,7 @@ export default function NextEventCountdown({
<p className="text-xs font-bold uppercase tracking-[0.25em]" style={{ color: accentText(accent) }}>
{live ? 'Happening now' : 'Next up'}
</p>
<p className="mt-1 truncate font-display text-2xl font-bold text-ink md:text-3xl">
<p className="mt-1 line-clamp-2 break-words font-display text-2xl font-bold text-ink md:text-3xl">
{event.title}
</p>
<p className="mt-1 text-sm text-muted">
@ -104,7 +104,9 @@ export default function NextEventCountdown({
</div>
{!live && (
<div className="flex gap-2 md:gap-3" role="timer" aria-live="off">
// Out of the link's name, which would otherwise change every
// second; the date above says when.
<div className="flex gap-2 md:gap-3" aria-hidden="true">
{parts.map(([label, value]) => (
<div
key={label}

View file

@ -12,6 +12,7 @@
import { useEffect, useRef, useState } from 'react'
import type { FrontPageStat } from '../../../lib/useFrontPage.ts'
import { prefersLessMotion } from '../../../lib/motion.ts'
const COUNT_MS = 1400
@ -86,9 +87,7 @@ function CountUp({ value, run }: { value: string; run: boolean }) {
const decimals = value.split('.')[1]?.length ?? 0
const grouped = value.includes(',')
const reduced =
typeof window !== 'undefined' &&
window.matchMedia?.('(prefers-reduced-motion: reduce)').matches
const reduced = typeof window !== 'undefined' && prefersLessMotion()
const [shown, setShown] = useState(0)