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:
parent
d067c02d33
commit
b816203c0c
45 changed files with 760 additions and 208 deletions
|
|
@ -278,6 +278,7 @@ export function FilePicker({
|
|||
return (
|
||||
<dialog
|
||||
ref={dialogRef}
|
||||
aria-label="Choose a file"
|
||||
onClose={onClose}
|
||||
onClick={(e) => {
|
||||
if (e.target === dialogRef.current) dialogRef.current?.close();
|
||||
|
|
@ -292,6 +293,7 @@ export function FilePicker({
|
|||
value={query}
|
||||
onChange={(e) => setQuery(e.target.value)}
|
||||
placeholder="Search by file name"
|
||||
aria-label="Search by file name"
|
||||
className="ml-auto w-56 border border-muted/25 px-3 py-1.5 text-sm outline-none focus:border-brand"
|
||||
/>
|
||||
<button
|
||||
|
|
|
|||
|
|
@ -439,6 +439,7 @@ export function MediaPicker({
|
|||
return (
|
||||
<dialog
|
||||
ref={dialogRef}
|
||||
aria-label="Choose an image"
|
||||
onClose={onClose}
|
||||
onClick={(e) => {
|
||||
// A click on the backdrop lands on the dialog itself.
|
||||
|
|
@ -454,6 +455,7 @@ export function MediaPicker({
|
|||
value={query}
|
||||
onChange={(e) => setQuery(e.target.value)}
|
||||
placeholder="Search by file name"
|
||||
aria-label="Search by file name"
|
||||
className="ml-auto w-56 border border-muted/25 px-3 py-1.5 text-sm outline-none focus:border-brand"
|
||||
/>
|
||||
<button
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
═══════════════════════════════════════════════════════════════ */
|
||||
|
||||
import { useEffect, useState } from "react";
|
||||
import { jumpTo } from "../../lib/focus.ts";
|
||||
import { scrollBehavior } from "../../lib/motion.ts";
|
||||
import { accentText } from "../../lib/color.ts";
|
||||
|
||||
|
|
@ -68,10 +69,6 @@ export function useActiveSection(sections: EditorSection[]) {
|
|||
return active;
|
||||
}
|
||||
|
||||
function jump(id: string) {
|
||||
document.getElementById(id)?.scrollIntoView({ behavior: scrollBehavior(), block: "start" });
|
||||
}
|
||||
|
||||
function Label({ section, wrap }: { section: EditorSection; wrap?: boolean }) {
|
||||
return (
|
||||
<>
|
||||
|
|
@ -80,7 +77,10 @@ function Label({ section, wrap }: { section: EditorSection; wrap?: boolean }) {
|
|||
<span className="text-xs text-muted/70">({section.count})</span>
|
||||
)}
|
||||
{section.hasError && (
|
||||
<span aria-label="needs attention" className="h-1.5 w-1.5 shrink-0 rounded-full bg-danger" />
|
||||
<>
|
||||
<span aria-hidden="true" className="h-1.5 w-1.5 shrink-0 rounded-full bg-danger" />
|
||||
<span className="sr-only">needs attention</span>
|
||||
</>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
|
|
@ -105,7 +105,7 @@ export function SectionNav({ sections, wrap = false }: { sections: EditorSection
|
|||
<li key={section.id}>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => jump(section.id)}
|
||||
onClick={() => jumpTo(section.id)}
|
||||
aria-current={lit ? "location" : undefined}
|
||||
style={section.accent ? ({ "--nav-accent": accentText(section.accent) } 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 ${
|
||||
|
|
@ -138,7 +138,11 @@ export function SectionJump({ sections }: { sections: EditorSection[] }) {
|
|||
<span className="shrink-0">Jump to</span>
|
||||
<select
|
||||
value={active ?? ""}
|
||||
onChange={(e) => jump(e.target.value)}
|
||||
// Scroll only: the arrow keys change a select option by
|
||||
// option, and taking focus away would stop that.
|
||||
onChange={(e) =>
|
||||
document.getElementById(e.target.value)?.scrollIntoView({ behavior: scrollBehavior(), block: "start" })
|
||||
}
|
||||
className="w-full border border-muted/25 bg-surface px-3 py-1.5 text-sm text-body outline-none focus:border-brand"
|
||||
>
|
||||
{sections.map((section) => (
|
||||
|
|
|
|||
|
|
@ -267,11 +267,22 @@ export function Field({ field, value, row, options, error, onChange, onPatch }:
|
|||
};
|
||||
const showFiles = field.files && !locked && (!field.filesWhen || fieldShown({ when: field.filesWhen }, row));
|
||||
|
||||
// The line under the field (its error, the deleted-row warning, or
|
||||
// its help) is read with it, and the field says when it's required
|
||||
// or wrong, not only the red star and border.
|
||||
const noteId = `${id}-note`;
|
||||
const hasNote = Boolean(error || (orphaned && !locked) || (helpText(field, row) && widget !== "checkbox"));
|
||||
const described = {
|
||||
"aria-describedby": hasNote ? noteId : undefined,
|
||||
"aria-invalid": Boolean(error || (orphaned && !locked)) || undefined,
|
||||
"aria-required": (field.required && !locked) || undefined,
|
||||
};
|
||||
const common = {
|
||||
id,
|
||||
className: `${input} ${error ? inputError : ""}`,
|
||||
value: value ?? "",
|
||||
onChange: (e) => onChange(e.target.value),
|
||||
...described,
|
||||
};
|
||||
|
||||
return (
|
||||
|
|
@ -336,6 +347,7 @@ export function Field({ field, value, row, options, error, onChange, onPatch }:
|
|||
value={/^#[0-9a-f]{6}$/i.test(value ?? "") ? value : colorPlaceholder(field, row)}
|
||||
disabled={locked}
|
||||
onChange={(e) => onChange(e.target.value)}
|
||||
aria-label={`${typeof field.label === "function" ? field.label(row) : field.label}: pick a color`}
|
||||
className="h-9 w-12 shrink-0 border border-muted/25 bg-surface disabled:opacity-50"
|
||||
/>
|
||||
<input
|
||||
|
|
@ -398,6 +410,7 @@ export function Field({ field, value, row, options, error, onChange, onPatch }:
|
|||
value={value ?? ""}
|
||||
onChange={(e) => onChange(e.target.value)}
|
||||
placeholder={field.placeholder}
|
||||
{...described}
|
||||
className="w-full border-0 bg-transparent p-0 text-body outline-none placeholder:text-muted/45"
|
||||
/>
|
||||
</div>
|
||||
|
|
@ -421,15 +434,15 @@ export function Field({ field, value, row, options, error, onChange, onPatch }:
|
|||
</div>
|
||||
|
||||
{error ? (
|
||||
<p className="mt-1 text-xs text-danger">{error}</p>
|
||||
<p id={noteId} className="mt-1 text-xs text-danger">{error}</p>
|
||||
) : orphaned && !locked ? (
|
||||
<p className="mt-1 text-xs text-danger">
|
||||
<p id={noteId} className="mt-1 text-xs text-danger">
|
||||
This points at something that has been deleted. Pick a replacement before saving.
|
||||
</p>
|
||||
) : (
|
||||
helpText(field, row) &&
|
||||
widget !== "checkbox" && (
|
||||
<p className="mt-1 text-xs text-muted">{helpText(field, row)}</p>
|
||||
<p id={noteId} className="mt-1 text-xs text-muted">{helpText(field, row)}</p>
|
||||
)
|
||||
)}
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue