This version introduces enhanced support for CSS animations and transitions, along with a few breaking changes for quite specific cases. The majority of users won't be impacted by these.
Please review the brief notes following the BREAKING labels on each update to determine if any changes are needed in your code.
Improved animation support
This version enhances support for CSS animations and transitions on Ariakit components that use Disclosure. This includes Dialog, Popover, Combobox, Select, Hovercard, Menu, and Tooltip.
These components now support enter and leave transitions and animations right out of the box, eliminating the need to provide an explicit animated
prop. If an enter animation is detected, the component will automatically wait for a leave animation to complete before unmounting or hiding itself.
Use the [data-enter]
selector for CSS transitions. For CSS animations, use the newly introduced [data-open]
selector. The [data-leave]
selector can be used for both transitions and animations.
ComboboxList
is no longer focusable
BREAKING if you're using the ComboboxList
component directly with Focusable
props.
The ComboboxList
component is no longer focusable and doesn't accept Focusable
props such as autoFocus
, disabled
, and onFocusVisible
anymore. If you need Focusable features specifically on the ComboboxList
component, you can use composition to render it as a Focusable
component.
Before:
<ComboboxList disabled />
After:
<ComboboxList render={<Focusable disabled />} />
Composite widgets with grid
role
BREAKING if you're manually setting the role="grid"
prop on a composite widget.
Ariakit automatically assigns the role
prop to all composite items to align with the container role
. For example, if SelectPopover
has its role set to listbox
(which is the default value), its owned SelectItem
elements will automatically get their role set to option
.
In previous versions, this was also valid for composite widgets with a grid
role, where the composite item element would automatically be given role="gridcell"
. This is no longer the case, and you're now required to manually pass role="gridcell"
to the composite item element if you're rendering a container with role="grid"
.
Before:
<SelectPopover role="grid">
<SelectRow> {/* Automatically gets role="row" */}
<SelectItem> {/* Automatically gets role="gridcell" */}
After:
<SelectPopover role="grid">
<SelectRow> {/* Still gets role="row" */}
<SelectItem role="gridcell">
This change is due to the possibility of rendering a composite item element with a different role as a child of a static div
with role="gridcell"
, which is a valid and frequently used practice when using the grid
role. As a result, you no longer have to manually adjust the role
prop on the composite item:
<SelectPopover role="grid">
<SelectRow>
<div role="gridcell">
<SelectItem render={<button />}>
Previously, you had to explicitly pass role="button"
to the SelectItem
component above, otherwise it would automatically receive role="gridcell"
, leading to an invalid accessibility tree.
Radio types have improved
BREAKING if you're using TypeScript and the onChange
prop on Radio
, FormRadio
, or MenuItemRadio
.
The onChange
callback argument type has changed from React.SyntheticEvent
to React.ChangeEvent
.
Before:
<Radio onChange={(event: React.SyntheticEvent) => {}} />
After:
<Radio onChange={(event: React.ChangeEvent) => {}} />
Public data attributes have now boolean values
BREAKING if you're depending on data attributes to carry an empty string (""
) value.
In previous versions, data attributes such as data-active
, data-active-item
, data-enter
, data-leave
, and data-focus-visible
would carry an empty string (""
) value when active, and undefined
when inactive. Now, they have a true
value when active, but remain undefined
when inactive.
Their use as CSS selectors remains unchanged. You should continue to select them with the attribute selector with no value (e.g., [data-enter]
). However, if you're employing them in different ways or have snapshot tests that depend on their value, you might need to update your code.
Removed deprecated features
BREAKING if you haven't addressed the deprecation warnings from previous releases.
This version eliminates features that were deprecated in previous releases: the backdropProps
and as
props, as well as the ability to use a render function for the children
prop across all components.
Before:
<Dialog backdropProps={{ className: "backdrop" }} />
<Combobox as="textarea" />
<Combobox>
{(props) => <textarea {...props} />}
</Combobox>
After:
<Dialog backdrop={<div className="backdrop" />} />
<Combobox render={<textarea />} />
<Combobox render={(props) => <textarea {...props} />} />
You can learn more about these new features in the Composition guide.
Other updates
- Deprecated
MenuBar
in favor of Menubar components. - Revamped utilities for creating Ariakit components.
- The
type
prop for the Tooltip has been deprecated. See Tooltip anchors must have accessible names. - Removed the ancestors of open, nested modals from the accessibility tree.
- Tooltips no longer use
aria-describedby
to associate the tooltip content with the anchor. - Added new
disclosure
property to disclosure stores. - Updated dependencies:
@ariakit/core@0.4.0