-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Overlay2 migration
Overlay in Blueprint v6.0 features some breaking changes compared to previous versions. To help you migrate to the new component, we've provided a new component called Overlay2 in @blueprintjs/core
v5.9.0+.
- The children of
<Overlay2>
must be native DOM elements or utilizeReact.forwardRef()
to forward any injected ref to their underlying DOM element(s). - For single-child overlays:
- if you attach your own
ref
to the child, you must pass the sameReact.RefObject<HTMLElement>
value to<Overlay2>
via thechildRef
prop (we need this to forward along to<CSSTransition>
).
- if you attach your own
- For overlays with multiple child elements:
- regardless of whether you need your own
ref
on the child elements, you must enumerate a collection of refs for each of these elements and pass the collection along as a record (keyed by the elements' corresponding Reactkey
values) to<Overlay2 childRefs={...}>
.
- regardless of whether you need your own
These components rely on global state for some focus management and scrolling interaction functionality. Previously, this state was stored in a module-level global variable. Overlay2 utilizes a safer pattern for this global state via the new OverlaysProvider context provider.
In Blueprint v5.9+, applications which use overlay-based components are highly recommended to add an <OverlaysProvider>
near the root of their application. This is optional (overlays will continue to work without it).
In Blueprint v6.0, <OverlaysProvider>
will be required for all users of overlay-based components.
ReactDOM.render(
+ <OverlaysProvider>
<HotkeysProvider>
<App />
</HotkeysProvider>
+ </OverlaysProvider>,
document.querySelector("#root"),
)
Important: <OverlaysProvider>
must come first (wrap around) <HotkeysProvider>
so that the latter context can properly render the global hotkeys dialog which relies on overlays.
- react-day-picker v8 migration
- HotkeysTarget & useHotkeys migration
- PanelStack2 migration
- Table 6.0 changes