@ariakit/react@0.2.0
Minor Changes
-
BREAKING: Moved props from the
usePopoverStorehook to thePopovercomponent:fixed,gutter,shift,flip,slide,overlap,sameWidth,fitViewport,arrowPadding,overflowPadding,getAnchorRect,renderCallback(renamed toupdatePosition). (#2279)The exception is the
placementprop that should still be passed to the store.Before:
const popover = usePopoverStore({ placement: "bottom", fixed: true, gutter: 8, shift: 8, flip: true, slide: true, overlap: true, sameWidth: true, fitViewport: true, arrowPadding: 8, overflowPadding: 8, getAnchorRect: (anchor) => anchor?.getBoundingClientRect(), renderCallback: (props) => props.defaultRenderCallback(), }); <Popover store={popover} />;
After:
const popover = usePopoverStore({ placement: "bottom" }); <Popover store={popover} fixed gutter={8} shift={8} flip slide overlap sameWidth fitViewport arrowPadding={8} overflowPadding={8} getAnchorRect={(anchor) => anchor?.getBoundingClientRect()} updatePosition={(props) => props.updatePosition()} />;
This change affects all the hooks and components that use
usePopoverStoreandPopoverunderneath:useComboboxStore,ComboboxPopover,useHovercardStore,Hovercard,useMenuStore,Menu,useSelectStore,SelectPopover,useTooltipStore,Tooltip.With this change, the underlying
@floating-ui/domdependency has been also moved to thePopovercomponent, which means it can be lazy loaded. See the Lazy Popover example. -
BREAKING: The backdrop element on the
Dialogcomponent is now rendered as a sibling rather than as a parent of the dialog. This should make it easier to animate them separately. (#2407)This might be a breaking change if you're relying on their parent/child relationship for styling purposes (for example, to position the dialog in the center of the backdrop). If that's the case, you can apply the following styles to the dialog to achieve the same effect:
.dialog { position: fixed; inset: 1rem; margin: auto; height: fit-content; max-height: calc(100vh - 2 * 1rem); }
These styles work even if the dialog is a child of the backdrop, so you can use them regardless of whether you're upgrading to this version or not.
Patch Changes
-
Deprecated the
backdropPropsprop on theDialogcomponent. Use thebackdropprop instead. (#2407) -
The
backdropprop on theDialogcomponent now accepts a JSX element as its value. (#2407) -
The
Dialogcomponent will now wait for being unmounted before restoring the body scroll when thehiddenprop is set tofalse. This should prevent the body scroll from being restored too early when the dialog is being animated out using third-party libraries like Framer Motion. (#2407) -
The
Tooltipcomponent now defaults to usearia-describedbyinstead ofaria-labelledby. (#2279)If you want to use the tooltip as a label for an anchor element, you can use the
typeprop onuseTooltipStore:useTooltipStore({ type: "label" });
-
The
Tooltipcomponent now supports mouse events. (#2279)It's now possible to hover over the tooltip without it disappearing, which makes it compliant with WCAG 1.4.13.
-
Fixed infinite loop on
Portalwith thepreserveTabOrderprop set totruewhen the portalled element is placed right after its original position in the React tree. (#2279) -
Updated dependencies:
@ariakit/react-core@0.2.0.