Calls onChange whenever the window is resized and the root font size has
changed with it.
A host page's root font size can change while one of MAIDR's dialogs is
open: a responsive page sets it in a media query, and a reader who resizes
the window, turns their device, or zooms the page -- which narrows the
window in CSS pixels -- crosses its breakpoints. The value MUI was given
when the dialog opened is then wrong by as much as the root moved. Only the
root is compared, which needs no probe: a resize leaves the reader's default
size alone.
Nothing else is watched. A stylesheet that changes the root at some other
time takes effect at the next render, which opening a dialog is.
Parameters
onChange: ()=>void
Called after each resize that changed the root font size
Returns ()=>void
A function that stops watching; a no-op where there is no window
(server-side rendering, a node test)
Calls
onChangewhenever the window is resized and the root font size has changed with it.A host page's root font size can change while one of MAIDR's dialogs is open: a responsive page sets it in a media query, and a reader who resizes the window, turns their device, or zooms the page -- which narrows the window in CSS pixels -- crosses its breakpoints. The value MUI was given when the dialog opened is then wrong by as much as the root moved. Only the root is compared, which needs no probe: a resize leaves the reader's default size alone.
Nothing else is watched. A stylesheet that changes the root at some other time takes effect at the next render, which opening a dialog is.