Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions src/__tests__/tooltip.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -302,4 +302,25 @@ describe("Tooltip Component", () => {
);
expect(container.firstChild).toHaveClass("custom-wrapper-class");
});

it("tooltip surface includes motion-reduce:transition-none for prefers-reduced-motion", async () => {
render(<Tooltip content="Reduced motion test" />);
const trigger = screen.getByLabelText("Help information");

fireEvent.mouseEnter(trigger);
await act(async () => {
await new Promise((r) => setTimeout(r, 50));
});

const tooltip = screen.getByRole("tooltip");
expect(tooltip.className).toContain("transition-opacity");
expect(tooltip.className).toContain("motion-reduce:transition-none");
});

it("trigger button includes motion-reduce:transition-none for prefers-reduced-motion", () => {
render(<Tooltip content="Trigger reduced motion" />);
const trigger = screen.getByLabelText("Help information");
expect(trigger.className).toContain("transition-colors");
expect(trigger.className).toContain("motion-reduce:transition-none");
});
});
8 changes: 4 additions & 4 deletions src/app/components/ui/toast-container.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
* dismiss the entire stack in one action — useful after a burst.
*/

import { AnimatePresence, motion } from "framer-motion";
import { Layers } from "lucide-react";
import { AnimatePresence, motion, useReducedMotion } from "framer-motion";
import { useToast } from "@/hooks/use-toast";
import { Toast } from "./toast";

export function ToastContainer() {
const { toasts, queued, dismiss, dismissAll } = useToast();
const { toasts, dismiss, dismissAll } = useToast();
const reducedMotion = useReducedMotion();

return (
<div
Expand Down Expand Up @@ -55,7 +55,7 @@ export function ToastContainer() {
initial={{ opacity: 0, y: 4 }}
animate={{ opacity: 1, y: 0 }}
exit={{ opacity: 0, y: 4 }}
transition={{ duration: 0.15 }}
transition={reducedMotion ? false : { duration: 0.15 }}
className="pointer-events-auto flex justify-end"
>
<button
Expand Down
Loading