Skip to content

Commit 10eb7d1

Browse files
Landmarks should have a unique role or role/label/title (i.e. accessible name) combination
1 parent 0d6e7d9 commit 10eb7d1

8 files changed

Lines changed: 14 additions & 3 deletions

File tree

src/app/(registry)/page.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,7 @@ export default function Home() {
345345
alias:
346346
</p>
347347
<CodeBlock
348+
ariaLabel="Test setup App.jsx example"
348349
code={`import { Button } from "@/components/ui/button"
349350
350351
export default function MyComponent() {

src/app/(registry)/rtl/page.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,7 @@ export default function RTLPage() {
242242
</p>
243243
<CodeBlock
244244
code={UseDirectionCode}
245+
ariaLabel="useDirection hook code"
245246
lang="tsx"
246247
showLineNumbers={true}
247248
className="bg-body-bg border"
@@ -310,6 +311,7 @@ export default function RTLPage() {
310311
<div>
311312
<h3 className="font-semibold text-xl mb-2">Basic Usage</h3>
312313
<CodeBlock
314+
ariaLabel="Basic RTL DirectionProvider example"
313315
code={`import { Direction } from "radix-ui";
314316
315317
export default function App() {
@@ -330,6 +332,7 @@ export default function App() {
330332
Using the Hook in Components
331333
</h3>
332334
<CodeBlock
335+
ariaLabel="Sidebar RTL useDirection example"
333336
code={`import { Direction } from "radix-ui";
334337
import { cn } from "@/lib/utils";
335338
@@ -361,6 +364,7 @@ export function Sidebar() {
361364
Code blocks should always remain LTR for readability:
362365
</p>
363366
<CodeBlock
367+
ariaLabel="Keep code blocks LTR example"
364368
code={`export function CodeBlock({ code }: { code: string }) {
365369
return (
366370
<div dir="ltr">

src/components/code-block.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ export function CodeBlock({
162162
return (
163163
<div
164164
dir="ltr"
165-
role="region"
165+
role={ariaLabel ? "region" : undefined}
166166
aria-label={ariaLabel}
167167
className={cn(
168168
"relative rounded-md bg-muted max-h-[400px] overflow-auto",

src/components/docsite/component-card.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const DemoWrapper = dynamic(() => import("@/components/demo-wrapper"), {
1111

1212
export function ComponentCard({ component }: ComponentCardProps) {
1313
return (
14-
<section>
14+
<section aria-label="Component preview">
1515
<div id="starting-kit">
1616
<div className="w-full min-w-0 overflow-x-hidden">
1717
<DemoWrapper name={component.name} />

src/components/layout/topbar.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,10 @@ export default function TopBar() {
522522

523523
{/* Top navigation */}
524524
<nav aria-label="Top navigation">
525-
<NavigationMenu className="hidden lg:flex">
525+
<NavigationMenu
526+
className="hidden lg:flex"
527+
aria-label="Site navigation"
528+
>
526529
<NavigationMenuList className="flex gap-3">
527530
{navItems.map((item) => {
528531
const normalizedPathname = pathname.replace(/\/$/, "") || "/";

src/components/ui/calendar.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ function Calendar({
9292
className={cn("p-3", className)}
9393
captionLayout={captionLayout}
9494
labels={{
95+
labelNav: () => "Month navigation",
9596
...labels,
9697
...(monthDropdownAriaLabel != null && !labels?.labelMonthDropdown
9798
? { labelMonthDropdown: () => monthDropdownAriaLabel }

src/components/ui/navigation-menu.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ function NavigationMenu({
1818
<NavigationMenuPrimitive.Root
1919
data-slot="navigation-menu"
2020
data-viewport={viewport}
21+
aria-label="Navigation menu"
2122
className={cn(
2223
"group/navigation-menu relative flex max-w-max flex-1 items-center justify-center",
2324
className,

src/components/ui/stack-navigation.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,7 @@ export function StackNavigation({
285285
)}
286286
>
287287
<nav
288+
aria-label={isHorizontal ? "Sidebar navigation" : "Stack navigation"}
288289
className={cn(
289290
!isHorizontal && "flex flex-col gap-1",
290291
isHorizontal &&

0 commit comments

Comments
 (0)