From 3f34d9709c535d46c2ff7c8e06e9c0364409b110 Mon Sep 17 00:00:00 2001 From: garima-agarwall Date: Tue, 9 Jun 2026 17:26:01 +0530 Subject: [PATCH] fix: improve accessibility for interactive UI elements - aria-labels, focus-visible, keyboard navigation --- .../dashboard/LeaderBoard/leaderboard.tsx | 2 +- src/components/merch/ProductCard.tsx | 2 +- src/components/navbar/NavbarIcon.tsx | 2 +- src/css/custom.css | 16 ++++++++++++++++ .../showcase/_components/ShowcaseCard/index.tsx | 2 +- 5 files changed, 20 insertions(+), 4 deletions(-) diff --git a/src/components/dashboard/LeaderBoard/leaderboard.tsx b/src/components/dashboard/LeaderBoard/leaderboard.tsx index c4738056..1b9e8550 100644 --- a/src/components/dashboard/LeaderBoard/leaderboard.tsx +++ b/src/components/dashboard/LeaderBoard/leaderboard.tsx @@ -148,7 +148,7 @@ function ContributorBadges({ if (!badges || badges.length === 0) return null; return ( -
+
{ if (e.key === "Enter" || e.key === " ") onClick?.(); }}> {badges.map((badge, index) => ( = ({ product, onAddToCart }) => { onHoverEnd={() => setIsHovered(false)} >
-
+
{ if (e.key === "Enter" || e.key === " ") openViewer(); }} style={{ cursor: 'pointer' }}> {product.title} {isHovered && ( { if (e.key === "Enter" || e.key === " ") { diff --git a/src/css/custom.css b/src/css/custom.css index db46de41..6ade235b 100644 --- a/src/css/custom.css +++ b/src/css/custom.css @@ -2718,3 +2718,19 @@ html[data-theme="dark"] .blog-post-page .markdown h4 { margin-top: 15px !important; } + +/* ===== Accessibility: focus-visible indicators ===== */ +:focus-visible { + outline: 2px solid var(--ifm-color-primary) !important; + outline-offset: 2px !important; + border-radius: 4px !important; +} + +button:focus-visible, +a:focus-visible, +[role="button"]:focus-visible, +[tabindex]:focus-visible { + outline: 2px solid var(--ifm-color-primary) !important; + outline-offset: 2px !important; + border-radius: 4px !important; +} diff --git a/src/pages/showcase/_components/ShowcaseCard/index.tsx b/src/pages/showcase/_components/ShowcaseCard/index.tsx index bfe2c2b9..6a2d5747 100644 --- a/src/pages/showcase/_components/ShowcaseCard/index.tsx +++ b/src/pages/showcase/_components/ShowcaseCard/index.tsx @@ -58,7 +58,7 @@ function ShowcaseCard({ user }: { user: User }) { return (
  • -
    +
    { if (e.key === "Enter" || e.key === " ") handleCardClick(); }} />