fix: aria-current on active nav links and stepper step
- header: mark active page with aria-current="page" + highlight underline - portal-shell sidebar: aria-current="page" on active nav link - order-stepper: aria-current="step" on the active step Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
This commit is contained in:
+17
-10
@@ -3,6 +3,7 @@
|
||||
import Link from "next/link";
|
||||
import { useEffect, useState } from "react";
|
||||
import { useTheme } from "next-themes";
|
||||
import { usePathname } from "next/navigation";
|
||||
import { useT } from "@/components/locale-provider";
|
||||
import { LocaleSwitcher } from "@/components/locale-switcher";
|
||||
|
||||
@@ -47,6 +48,7 @@ function ThemeToggle() {
|
||||
|
||||
export function Header() {
|
||||
const t = useT();
|
||||
const pathname = usePathname();
|
||||
const [scrolled, setScrolled] = useState(false);
|
||||
const [open, setOpen] = useState(false);
|
||||
|
||||
@@ -69,16 +71,21 @@ export function Header() {
|
||||
<Wordmark />
|
||||
|
||||
<nav className="hidden items-center md:flex">
|
||||
{NAV.map((n) => (
|
||||
<Link
|
||||
key={n.href}
|
||||
href={n.href}
|
||||
className="group relative px-4 py-2 font-mono text-[12px] uppercase tracking-[0.12em] text-muted-foreground transition-colors hover:text-foreground"
|
||||
>
|
||||
{t(n.label)}
|
||||
<span aria-hidden className="pointer-events-none absolute bottom-1 left-4 right-4 h-px origin-left scale-x-0 bg-foreground transition-transform duration-300 group-hover:scale-x-100" />
|
||||
</Link>
|
||||
))}
|
||||
{NAV.map((n) => {
|
||||
const active = !n.href.includes("#") && pathname === n.href;
|
||||
return (
|
||||
<Link
|
||||
key={n.href}
|
||||
href={n.href}
|
||||
aria-current={active ? "page" : undefined}
|
||||
className="group relative px-4 py-2 font-mono text-[12px] uppercase tracking-[0.12em] text-muted-foreground transition-colors hover:text-foreground"
|
||||
style={{ color: active ? "var(--foreground)" : undefined }}
|
||||
>
|
||||
{t(n.label)}
|
||||
<span aria-hidden className="pointer-events-none absolute bottom-1 left-4 right-4 h-px origin-left bg-foreground transition-transform duration-300 group-hover:scale-x-100" style={{ transform: active ? "scaleX(1)" : "scaleX(0)", transformOrigin: "left" }} />
|
||||
</Link>
|
||||
);
|
||||
})}
|
||||
</nav>
|
||||
|
||||
<div className="hidden items-center gap-4 md:flex">
|
||||
|
||||
Reference in New Issue
Block a user