Repository navigation
Toasts 3.8.1 — native focus scopes without Radix
Native toast focus without Radix
Toast dialog integration now uses native DOM hosts and the Popover API instead of @radix-ui/react-focus-scope. Six Radix packages are removed from the dependency tree, with no replacement dependency.
- Keeps
ToastFocusScopeBranchavailable from the main entry and/radixfor existing imports. - Places toast actions inside the active dialog's DOM, including nested native dialogs, and restores inline, body or custom portals when the dialog closes.
- Preserves viewport positioning inside transformed or clipped dialog content through a native top-layer host.
- Replaces whole-body mutation observation and repeated toast-region searches with targeted host/ancestor attribute observation.
- Adds an optional
activeprop for custom dialog lifecycles and skips closed, hidden or inert hosts.
Upgrade
npm install @rentnerkev/toasts@3.8.1 lucide-react@^1React 19, React DOM 19 and the existing styling setup remain required. @radix-ui/react-focus-scope is no longer a toast peer dependency; its direct installation can be removed if no other application code needs it.
Integration behavior
ToastFocusScopeBranch now renders an empty native host. Keep it inside the dialog content. Native dialog open/closed state is detected automatically; custom dialogs without corresponding DOM state can control the host with active.
Opening or closing a dialog changes the portal destination and remounts toast cards. Copy feedback and entry animations restart during that transition; toast IDs, store contents and remaining timers are retained.
Before/after measurements
Same production bundler settings and environment, compared with pre-change main 12a13ae:
| Entry | Before gzip | After gzip |
|---|---|---|
| Dialog adapter | 1,355 B | 1,022 B |
| Complete public API | 12,005 B | 11,787 B |
| Provider-only consumer | 10,645 B | 10,823 B |
For 300 unrelated DOM changes with ten hosts, observer callbacks and toast-region searches both drop from 3,000 to zero. These isolate adapter overhead and are not general rendering or FPS claims. Full methodology, runtime samples and the provider size trade-off: #48.
Verification
164 unit tests and 105 browser cases passed, including Chromium, Firefox and WebKit, SSR, focus/timer behavior, viewport positioning and fresh packed npm consumers. React 19.0/19.3 compatibility checks passed. The release pipeline rebuilds and verifies the exact v3.8.1 source before npm publication.
Release · v3.8.1
Stable Release · Published on 29 October 2026
