diff --git a/.changeset/__breaking-1.md b/.changeset/__breaking-1.md new file mode 100644 index 0000000000..5aeff8f1bb --- /dev/null +++ b/.changeset/__breaking-1.md @@ -0,0 +1,57 @@ +--- +"@ariakit/core": minor +"@ariakit/react-core": minor +"@ariakit/react": minor +--- + +**BREAKING**: Moved props from the `usePopoverStore` hook to the `Popover` component: `fixed`, `gutter`, `shift`, `flip`, `slide`, `overlap`, `sameWidth`, `fitViewport`, `arrowPadding`, `overflowPadding`, `getAnchorRect`, `renderCallback` (renamed to `updatePosition`). ([#2279](https://github.com/ariakit/ariakit/pull/2279)) + +The exception is the `placement` prop that should still be passed to the store. + +**Before**: + +```jsx +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(), +}); + +; +``` + +**After**: + +```jsx +const popover = usePopoverStore({ placement: "bottom" }); + + anchor?.getBoundingClientRect()} + updatePosition={(props) => props.updatePosition()} +/>; +``` + +This change affects all the hooks and components that use `usePopoverStore` and `Popover` underneath: `useComboboxStore`, `ComboboxPopover`, `useHovercardStore`, `Hovercard`, `useMenuStore`, `Menu`, `useSelectStore`, `SelectPopover`, `useTooltipStore`, `Tooltip`. + +With this change, the underlying `@floating-ui/dom` dependency has been also moved to the `Popover` component, which means it can be lazy loaded. See the [Lazy Popover](https://ariakit.org/examples/popover-lazy) example. diff --git a/.changeset/curvy-taxis-shave-2.md b/.changeset/curvy-taxis-shave-2.md new file mode 100644 index 0000000000..8575c3eceb --- /dev/null +++ b/.changeset/curvy-taxis-shave-2.md @@ -0,0 +1,12 @@ +--- +"@ariakit/react-core": patch +"@ariakit/react": patch +--- + +The `Tooltip` component now defaults to use `aria-describedby` instead of `aria-labelledby`. ([#2279](https://github.com/ariakit/ariakit/pull/2279)) + +If you want to use the tooltip as a label for an anchor element, you can use the `type` prop on `useTooltipStore`: + +```jsx +useTooltipStore({ type: "label" }); +``` diff --git a/.changeset/curvy-taxis-shave.md b/.changeset/curvy-taxis-shave.md new file mode 100644 index 0000000000..0c56028b3f --- /dev/null +++ b/.changeset/curvy-taxis-shave.md @@ -0,0 +1,8 @@ +--- +"@ariakit/react-core": patch +"@ariakit/react": patch +--- + +The `Tooltip` component now supports mouse events. ([#2279](https://github.com/ariakit/ariakit/pull/2279)) + +It's now possible to hover over the tooltip without it disappearing, which makes it compliant with [WCAG 1.4.13](https://www.w3.org/WAI/WCAG21/Understanding/content-on-hover-or-focus.html). diff --git a/.changeset/mighty-cougars-rule.md b/.changeset/mighty-cougars-rule.md new file mode 100644 index 0000000000..31a1693b88 --- /dev/null +++ b/.changeset/mighty-cougars-rule.md @@ -0,0 +1,6 @@ +--- +"@ariakit/react-core": patch +"@ariakit/react": patch +--- + +Fixed infinite loop on `Portal` with the `preserveTabOrder` prop set to `true` when the portalled element is placed right after its original position in the React tree. ([#2279](https://github.com/ariakit/ariakit/pull/2279)) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a7aa06c349..8603e170eb 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -287,7 +287,7 @@ jobs: - name: Test id: test - run: npm run test-chrome + run: npm run playwright -- --project chrome --project android - name: Upload test results to GitHub if: failure() && steps.test.outcome == 'failure' @@ -341,7 +341,7 @@ jobs: - name: Test id: test - run: npm run playwright -- --project firefox --project safari + run: npm run playwright -- --project firefox --project safari --project ios - name: Upload test results to GitHub if: failure() && steps.test.outcome == 'failure' diff --git a/examples/combobox-animated/index.tsx b/examples/combobox-animated/index.tsx index 5f7d3df8b7..7407c29ad8 100644 --- a/examples/combobox-animated/index.tsx +++ b/examples/combobox-animated/index.tsx @@ -2,11 +2,7 @@ import * as Ariakit from "@ariakit/react"; import "./style.css"; export default function Example() { - const combobox = Ariakit.useComboboxStore({ - gutter: 4, - sameWidth: true, - animated: true, - }); + const combobox = Ariakit.useComboboxStore({ animated: true }); return (
- + 🍎 Apple diff --git a/examples/combobox-cancel/index.tsx b/examples/combobox-cancel/index.tsx index f0a8c995f4..6a804061ce 100644 --- a/examples/combobox-cancel/index.tsx +++ b/examples/combobox-cancel/index.tsx @@ -12,7 +12,7 @@ const list = [ ]; export default function Example() { - const combobox = Ariakit.useComboboxStore({ gutter: 4, sameWidth: true }); + const combobox = Ariakit.useComboboxStore(); return (
- + {list.map((value) => (
- + 🍕 Pizza diff --git a/examples/combobox-group/index.tsx b/examples/combobox-group/index.tsx index a816e1a42e..9c67a9b8e0 100644 --- a/examples/combobox-group/index.tsx +++ b/examples/combobox-group/index.tsx @@ -6,7 +6,7 @@ import food from "./food.js"; import "./style.css"; export default function Example() { - const combobox = Ariakit.useComboboxStore({ gutter: 4, sameWidth: true }); + const combobox = Ariakit.useComboboxStore(); const value = combobox.useState("value"); const deferredValue = React.useDeferredValue(value); @@ -27,7 +27,12 @@ export default function Example() { autoSelect /> - + {!!matches.length ? ( matches.map(([type, items], i) => ( diff --git a/examples/combobox-inline-autocomplete/index.tsx b/examples/combobox-inline-autocomplete/index.tsx index 6f0b7a89a3..c87d9f4be0 100644 --- a/examples/combobox-inline-autocomplete/index.tsx +++ b/examples/combobox-inline-autocomplete/index.tsx @@ -2,7 +2,7 @@ import * as Ariakit from "@ariakit/react"; import "./style.css"; export default function Example() { - const combobox = Ariakit.useComboboxStore({ gutter: 8, sameWidth: true }); + const combobox = Ariakit.useComboboxStore(); return (
- + 🍎 Apple diff --git a/examples/combobox-item-value/index.tsx b/examples/combobox-item-value/index.tsx index 78fc9b79eb..8cb5100dd9 100644 --- a/examples/combobox-item-value/index.tsx +++ b/examples/combobox-item-value/index.tsx @@ -4,7 +4,7 @@ import "./style.css"; const fruits = ["Apple", "Grape", "Orange", "Strawberry", "Watermelon"]; export default function Example() { - const combobox = Ariakit.useComboboxStore({ gutter: 8, sameWidth: true }); + const combobox = Ariakit.useComboboxStore(); return (
- + {fruits.map((f) => ( diff --git a/examples/combobox-links/index.tsx b/examples/combobox-links/index.tsx index 132113d666..5b0dabee67 100644 --- a/examples/combobox-links/index.tsx +++ b/examples/combobox-links/index.tsx @@ -24,11 +24,7 @@ const links = [ ]; export default function Example() { - const combobox = Ariakit.useComboboxStore({ - gutter: 4, - sameWidth: true, - }); - + const combobox = Ariakit.useComboboxStore(); const mounted = combobox.useState("mounted"); const value = combobox.useState("value"); const deferredValue = useDeferredValue(value); @@ -72,7 +68,12 @@ export default function Example() { /> {mounted && ( - + {matches.length ? ( matches.map(renderItem) ) : ( diff --git a/examples/combobox-matches/index.tsx b/examples/combobox-matches/index.tsx index cb38f5bb27..4eca48663f 100644 --- a/examples/combobox-matches/index.tsx +++ b/examples/combobox-matches/index.tsx @@ -5,7 +5,7 @@ import list from "./list.js"; import "./style.css"; export default function Example() { - const combobox = Ariakit.useComboboxStore({ gutter: 8, sameWidth: true }); + const combobox = Ariakit.useComboboxStore(); const value = combobox.useState("value"); const deferredValue = useDeferredValue(value); @@ -24,7 +24,12 @@ export default function Example() { className="combobox" /> - + {matches.length ? ( matches.map((value) => ( - + 🍎 Apple diff --git a/examples/combobox-multiple/combobox-multiple.tsx b/examples/combobox-multiple/combobox-multiple.tsx index 8c7afa2985..4fb5db7417 100644 --- a/examples/combobox-multiple/combobox-multiple.tsx +++ b/examples/combobox-multiple/combobox-multiple.tsx @@ -35,8 +35,6 @@ export const ComboboxMultiple = React.forwardRef< // is on the combobox input, so we set `virtualFocus` to `false` to disable // this behavior and put DOM focus on the items. virtualFocus: false, - sameWidth: true, - gutter: 8, defaultValue, value, setValue: onChange, @@ -76,7 +74,12 @@ export const ComboboxMultiple = React.forwardRef< ) : ( element )} - + {(popoverProps) => ( (null); const [caretOffset, setCaretOffset] = React.useState(null); - const combobox = Ariakit.useComboboxStore({ - fitViewport: true, - getAnchorRect: () => { - const textarea = ref.current; - if (!textarea) return null; - return getAnchorRect(textarea); - }, - }); + const combobox = Ariakit.useComboboxStore(); const searchValue = combobox.useState("value"); const mounted = combobox.useState("mounted"); @@ -127,6 +120,12 @@ export default function Example() {