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:
parent
420a8058b4
commit
de17da7dc8
19 changed files with 507 additions and 192 deletions
15
src/lib/readingMode.ts
Normal file
15
src/lib/readingMode.ts
Normal 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)
|
||||
Loading…
Add table
Add a link
Reference in a new issue