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:
@@ -121,12 +121,16 @@ export default function ValidationPage() {
|
||||
|
||||
<div className="mx-auto max-w-[80rem] px-6 py-12">
|
||||
{/* tabs */}
|
||||
<div className="reveal flex flex-wrap border-b border-border">
|
||||
<div role="tablist" aria-label={t({ en: "Result views", sv: "Resultatvyer" })} className="reveal flex flex-wrap border-b border-border">
|
||||
{TABS.map((tb, i) => (
|
||||
<button
|
||||
key={tb.key}
|
||||
id={`validera-tab-${tb.key}`}
|
||||
role="tab"
|
||||
aria-selected={tab === tb.key}
|
||||
aria-controls={`validera-panel-${tb.key}`}
|
||||
onClick={() => setTab(tb.key)}
|
||||
className="group relative -mb-px px-5 py-3.5 font-mono text-[11px] uppercase tracking-[0.12em] transition-colors"
|
||||
className="group relative -mb-px px-5 py-3.5 font-mono text-[11px] uppercase tracking-[0.12em] transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background"
|
||||
style={{ color: tab === tb.key ? "var(--foreground)" : "var(--muted-foreground)" }}
|
||||
>
|
||||
<span className="mr-2 text-muted-foreground">{String(i + 1).padStart(2, "0")}</span>
|
||||
@@ -140,7 +144,13 @@ export default function ValidationPage() {
|
||||
))}
|
||||
</div>
|
||||
|
||||
<div className="mt-10">
|
||||
<div
|
||||
className="mt-10"
|
||||
role="tabpanel"
|
||||
id={`validera-panel-${tab}`}
|
||||
aria-labelledby={`validera-tab-${tab}`}
|
||||
tabIndex={0}
|
||||
>
|
||||
{/* Table tab */}
|
||||
{tab === "table" ? (
|
||||
<div className="reveal-fade">
|
||||
|
||||
Reference in New Issue
Block a user