- {({ onKeyDownHandler }) => (
-
- {button1}
- {button2}
- {button3}
-
- )}
- ,
+ describe("handles keyboard navigation", () => {
+ it("handles up/down arrow keys when handleUpDown=true", async () => {
+ const { container } = renderToolbar(
+ <>
+ {button1}
+ {button2}
+ {button3}
+ >,
+ { handleUpDown: true },
);
act(() => container.querySelectorAll("button")[0].focus());
@@ -405,29 +404,160 @@ describe("RovingTabIndex", () => {
await userEvent.keyboard("[ArrowUp]");
checkTabIndexes(container.querySelectorAll("button"), [0, -1, -1]);
- // Does not loop without
await userEvent.keyboard("[ArrowUp]");
checkTabIndexes(container.querySelectorAll("button"), [0, -1, -1]);
});
- it("should call scrollIntoView if specified", async () => {
- const { container } = render(
-