feat(a11y): add ARIA tablist/tab/tabpanel roles + i18n error page
- validera: role=tablist + role=tab + aria-selected + aria-controls/id on tab buttons; role=tabpanel + id + aria-labelledby on content div - katalog/[id]: same ARIA tab pattern; replaced incorrect aria-current=page on tab buttons with role=tab + aria-selected - error.tsx: i18n all hardcoded English strings via useT() All three changes pass tsc 0. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
This commit is contained in:
+7
-5
@@ -3,6 +3,7 @@
|
||||
import Link from "next/link";
|
||||
import { useEffect } from "react";
|
||||
import { Header } from "@/components/header";
|
||||
import { useT } from "@/components/locale-provider";
|
||||
|
||||
export default function Error({
|
||||
error,
|
||||
@@ -11,6 +12,7 @@ export default function Error({
|
||||
error: Error & { digest?: string };
|
||||
reset: () => void;
|
||||
}) {
|
||||
const t = useT();
|
||||
useEffect(() => {
|
||||
console.error(error);
|
||||
}, [error]);
|
||||
@@ -27,26 +29,26 @@ export default function Error({
|
||||
500
|
||||
</span>
|
||||
<p className="font-mono text-[11px] uppercase tracking-[0.18em] text-muted-foreground">
|
||||
Error
|
||||
{t({ en: "Error", sv: "Fel" })}
|
||||
</p>
|
||||
<h1 className="mt-5 max-w-[14ch] text-[clamp(2.6rem,7vw,5.5rem)] font-medium leading-[0.95] tracking-[-0.035em]">
|
||||
Something went wrong.
|
||||
{t({ en: "Something went wrong.", sv: "Något gick fel." })}
|
||||
</h1>
|
||||
<p className="mt-6 max-w-[40ch] font-mono text-sm text-muted-foreground">
|
||||
An unexpected error occurred. Nothing was guessed.{error.digest ? ` (${error.digest})` : ""}
|
||||
{t({ en: "An unexpected error occurred. Nothing was guessed.", sv: "Ett oväntat fel inträffade. Inget gissades." })}{error.digest ? ` (${error.digest})` : ""}
|
||||
</p>
|
||||
<div className="mt-12 flex flex-wrap gap-3">
|
||||
<button
|
||||
onClick={reset}
|
||||
className="bg-foreground px-7 py-4 font-mono text-[12px] uppercase tracking-[0.14em] text-background transition-colors hover:bg-[var(--accent-red)]"
|
||||
>
|
||||
Try again →
|
||||
{t({ en: "Try again →", sv: "Försök igen →" })}
|
||||
</button>
|
||||
<Link
|
||||
href="/"
|
||||
className="border border-foreground px-7 py-4 font-mono text-[12px] uppercase tracking-[0.14em] transition-colors hover:bg-foreground hover:text-background"
|
||||
>
|
||||
Home
|
||||
{t({ en: "Home", sv: "Hem" })}
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user