Skip to content
Closed
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
3 changes: 2 additions & 1 deletion app/error.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import { useEffect } from "react";
import { Button } from "@heroui/react";
import { AlertCircle, RefreshCcw } from "lucide-react";
import { AlertCircle, RefreshCcw, RotateCcw } from "lucide-react";
import { reportError } from "@/lib/error-reporting";

export default function Error({
Expand Down Expand Up @@ -34,6 +34,7 @@ export default function Error({
onClick={() => window.location.reload()}
className="focus-ring rounded-xl px-8"
>
<RotateCcw className="h-4 w-4 mr-2" aria-hidden="true" />
Reload Page
</Button>
<Button
Expand Down
11 changes: 11 additions & 0 deletions tests/unit/app/error.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,17 @@ describe("Error component", () => {
expect(mockReset).toHaveBeenCalledTimes(1);
});

it("ensures decorative icons are hidden from screen readers", () => {
const { container } = render(
<ErrorComponent error={mockError} reset={mockReset} />
);
const svgs = container.querySelectorAll("svg");
expect(svgs.length).toBeGreaterThan(0);
svgs.forEach((svg) => {
expect(svg).toHaveAttribute("aria-hidden", "true");
});
});

it("reloads the page when 'Reload Page' button is clicked", () => {
const reloadMock = vi.fn();

Expand Down
Loading