Closed mayank99 closed 1 year ago
I have decided to leave out modals/toasts from this PR because I think those are less important from a scoping perspective (they always appear in the same place, regardless of what part of the app is scoped).
In a future PR I plan to introduce two new hooks:
useRoot
which will return the nearest ThemeProvider
element (and can then be passed into Modal or Toast).useToaster
which will automatically put toasts in a scoped root.
Fixes #898 for popovers. Modals and toasts will still respect the topmost ThemeProvider but not any scoped roots.
Main changes
rootRef
.rootRef
from theme context and uses it forappendTo
..iui-root
if one exists.useTheme
because it unnecessarily runs a layout effect outside the main tree, adding redundant classes to<body>
.