Skip to content

Commit 53deda1

Browse files
Merge pull request #734 from Sitecore/bcn/bf/moderate-bugfixes-6/9/22
moderate issue fixes
2 parents 5ac18aa + 88bfa94 commit 53deda1

6 files changed

Lines changed: 94 additions & 79 deletions

File tree

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@ export default function RTLPage() {
226226
component:
227227
</p>
228228
<CodeBlock
229+
ariaLabel="Direction provider code"
229230
code={DirectionProviderCode}
230231
lang="tsx"
231232
showLineNumbers={true}

src/app/content/ui/draggable/draggable-basic.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ export default function DraggableBasicDragDropDemo() {
135135
>
136136
<div className="p-6 space-y-6">
137137
<div>
138-
<h3 className="text-2xl font-semibold">Basic Drag & Drop</h3>
138+
<h2 className="text-2xl font-semibold">Basic Drag & Drop</h2>
139139
<p className="text-sm text-muted-foreground mt-2">
140140
Drag fields from the source to the drop zone. The drop zone shows an
141141
active state when fields can be dropped.

src/app/content/ui/popover/popover.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export default function PopoverDemo() {
1616
<PopoverContent className="w-80" align="start">
1717
<div className="grid gap-4">
1818
<div className="grid gap-0.5">
19-
<h4 className="leading-none font-semibold">Dimensions</h4>
19+
<h2 className="leading-none font-semibold">Dimensions</h2>
2020
<p className="text-muted-foreground text-sm">
2121
Set the dimensions for the layer.
2222
</p>

src/components/bloks/site-card.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,12 +123,12 @@ export function SiteCard<T extends SiteData>({
123123
>
124124
{/* Site Title */}
125125
<div className="w-full space-y-0.5">
126-
<h3
126+
<h2
127127
className="text-sm font-semibold truncate leading-tight"
128128
title={site.displayName || site.name}
129129
>
130130
{site.displayName || site.name}
131-
</h3>
131+
</h2>
132132
{site.collectionName && (
133133
<p
134134
className="text-xs text-muted-foreground truncate leading-tight"

src/components/layout/right-sidebar.tsx

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -123,11 +123,21 @@ export function RightSidebar({
123123

124124
if (!hasContent) return null;
125125

126+
const pageTitle = pageName?.replace(/-/g, " ") ?? "";
127+
126128
return (
127-
<div className="hidden xl:block xl:sticky xl:top-12 xl:h-[calc(100vh-48px)] xl:w-[250px] xl:overflow-y-auto xl:shrink-0 p-10 space-y-8 bg-transparent">
129+
<aside
130+
aria-label="Page sidebar"
131+
className="hidden xl:block xl:sticky xl:top-12 xl:h-[calc(100vh-48px)] xl:w-[250px] xl:overflow-y-auto xl:shrink-0 p-10 space-y-8 bg-transparent"
132+
>
128133
{/* Links Section */}
129134
{links && Object.keys(links).length > 0 && (
130-
<div className="space-y-2.5">
135+
<nav
136+
className="space-y-2.5"
137+
aria-label={
138+
pageTitle ? `Related links: ${pageTitle}` : "Related links"
139+
}
140+
>
131141
{links.shadcn && (
132142
<Link
133143
href={links.shadcn}
@@ -272,15 +282,17 @@ export function RightSidebar({
272282
<span>Website</span>
273283
</Link>
274284
)}
275-
</div>
285+
</nav>
276286
)}
277287

278288
{/* Custom Children */}
279289
{children}
280290

281291
{/* Navigation Section */}
282292
{sections.length > 0 && (
283-
<nav>
293+
<nav
294+
aria-label={pageTitle ? `On this page: ${pageTitle}` : "On this page"}
295+
>
284296
<ul className="space-y-2">
285297
{sections.map((section) => (
286298
<li key={section.id}>
@@ -315,6 +327,6 @@ export function RightSidebar({
315327
</ul>
316328
</nav>
317329
)}
318-
</div>
330+
</aside>
319331
);
320332
}

src/components/layout/topbar.tsx

Lines changed: 72 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,7 @@ export default function TopBar() {
501501
};
502502

503503
return (
504-
<header className="w-full bg-background border-b border-border">
504+
<div className="w-full bg-background border-b border-border">
505505
<div className="flex items-center justify-between h-12 px-4">
506506
{/* Left: Logo + Navigation */}
507507
<div className="flex items-center gap-4">
@@ -520,78 +520,80 @@ export default function TopBar() {
520520
/>
521521
</Link>
522522

523-
{/* Desktop Navigation */}
524-
<NavigationMenu className="hidden lg:flex">
525-
<NavigationMenuList className="flex gap-3">
526-
{navItems.map((item) => {
527-
const normalizedPathname = pathname.replace(/\/$/, "") || "/";
528-
const normalizedHref = item.href.replace(/\/$/, "") || "/";
529-
let isActive =
530-
normalizedPathname === normalizedHref ||
531-
(normalizedHref !== "/" &&
532-
normalizedPathname.startsWith(`${normalizedHref}/`)) ||
533-
clickedHref === item.href;
534-
535-
// Special handling for registry pages
536-
if (pathname.startsWith("/registry/")) {
537-
const segments = pathname.split("/").filter(Boolean);
538-
const itemName = segments[segments.length - 1];
539-
540-
if (itemName) {
541-
const registryItem = getRegistryItem(itemName);
542-
543-
if (registryItem) {
544-
// If this is a UI component and we're checking "Primitives"
545-
if (
546-
item.name === "Primitives" &&
547-
registryItem.type === "registry:ui"
548-
) {
549-
isActive = true;
550-
}
551-
// If this is a block/component and we're checking "Bloks"
552-
else if (
553-
item.name === "Bloks" &&
554-
(registryItem.type === "registry:block" ||
555-
registryItem.type === "registry:component")
556-
) {
557-
isActive = true;
523+
{/* Top navigation */}
524+
<nav aria-label="Top navigation">
525+
<NavigationMenu className="hidden lg:flex">
526+
<NavigationMenuList className="flex gap-3">
527+
{navItems.map((item) => {
528+
const normalizedPathname = pathname.replace(/\/$/, "") || "/";
529+
const normalizedHref = item.href.replace(/\/$/, "") || "/";
530+
let isActive =
531+
normalizedPathname === normalizedHref ||
532+
(normalizedHref !== "/" &&
533+
normalizedPathname.startsWith(`${normalizedHref}/`)) ||
534+
clickedHref === item.href;
535+
536+
// Special handling for registry pages
537+
if (pathname.startsWith("/registry/")) {
538+
const segments = pathname.split("/").filter(Boolean);
539+
const itemName = segments[segments.length - 1];
540+
541+
if (itemName) {
542+
const registryItem = getRegistryItem(itemName);
543+
544+
if (registryItem) {
545+
// If this is a UI component and we're checking "Primitives"
546+
if (
547+
item.name === "Primitives" &&
548+
registryItem.type === "registry:ui"
549+
) {
550+
isActive = true;
551+
}
552+
// If this is a block/component and we're checking "Bloks"
553+
else if (
554+
item.name === "Bloks" &&
555+
(registryItem.type === "registry:block" ||
556+
registryItem.type === "registry:component")
557+
) {
558+
isActive = true;
559+
}
558560
}
559561
}
560562
}
561-
}
562563

563-
return (
564-
<NavigationMenuItem key={item.name}>
565-
<Link
566-
href={item.href}
567-
onClick={() => {
568-
setClickedHref(item.href);
569-
track(TELEMETRY_EVENTS.topbar_nav_click, {
570-
link: item.href,
571-
label: item.name,
572-
is_mobile: false,
573-
});
574-
}}
575-
className={`${navigationMenuTriggerStyle()} ${
576-
isActive ? "active" : ""
577-
}`}
578-
>
579-
{item.name}
580-
</Link>
581-
</NavigationMenuItem>
582-
);
583-
})}
584-
</NavigationMenuList>
585-
</NavigationMenu>
586-
587-
{/* Mobile Nav Dropdown — client-only Radix to avoid hydration id drift */}
588-
<div className="lg:hidden">
589-
<MobileNavDropdown
590-
pathname={pathname}
591-
clickedHref={clickedHref}
592-
setClickedHref={setClickedHref}
593-
/>
594-
</div>
564+
return (
565+
<NavigationMenuItem key={item.name}>
566+
<Link
567+
href={item.href}
568+
onClick={() => {
569+
setClickedHref(item.href);
570+
track(TELEMETRY_EVENTS.topbar_nav_click, {
571+
link: item.href,
572+
label: item.name,
573+
is_mobile: false,
574+
});
575+
}}
576+
className={`${navigationMenuTriggerStyle()} ${
577+
isActive ? "active" : ""
578+
}`}
579+
>
580+
{item.name}
581+
</Link>
582+
</NavigationMenuItem>
583+
);
584+
})}
585+
</NavigationMenuList>
586+
</NavigationMenu>
587+
588+
{/* Mobile Nav Dropdown — client-only Radix to avoid hydration id drift */}
589+
<div className="lg:hidden">
590+
<MobileNavDropdown
591+
pathname={pathname}
592+
clickedHref={clickedHref}
593+
setClickedHref={setClickedHref}
594+
/>
595+
</div>
596+
</nav>
595597
</div>
596598

597599
{/* Right Section */}
@@ -776,6 +778,6 @@ export default function TopBar() {
776778
</Button>
777779
</div>
778780
</div>
779-
</header>
781+
</div>
780782
);
781783
}

0 commit comments

Comments
 (0)