/* Whether the accessibility panel's reading mode is 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)