fix(ui): real heading structure and a nav landmark for the sidebar (#1751)
Quality / check (push) Canceled after 4m2s
deploy / gate (push) Successful in 4m52s
deploy / archied-image (push) Successful in 3m30s
deploy / agent-image (push) Successful in 11s
deploy / dist-zip (push) Skipped

CardTitle and EmptyTitle take an as prop (default h2) and render through
component :is, so card and empty-state titles are headings; Section passes
as="h2" under the page's h1. The sidebar menu list now sits in
<nav aria-label="Sections">.
This commit is contained in:
sam committed 2026-11-06 23:56:34 +11:00
1 parent 53c6b3e413
commit ee2d19d011
4 files changed
+26 -12

No files matched your search

+3 -1
View File
@@ -28,7 +28,8 @@ watch(() => route.path, () => { if (isMobile.value) setOpenMobile(false); });
<template>
<SidebarGroup>
<SidebarMenu aria-label="Sections">
<nav aria-label="Sections">
<SidebarMenu>
<SidebarMenuItem v-for="entry in links" :key="entry.path">
<SidebarMenuButton as-child :tooltip="entry.label" :is-active="activePath === entry.path" class="max-md:h-11">
<RouterLink :to="entry.path" :aria-current="activePath === entry.path ? 'page' : undefined">
@@ -38,5 +39,6 @@ watch(() => route.path, () => { if (isMobile.value) setOpenMobile(false); });
</SidebarMenuButton>
</SidebarMenuItem>
</SidebarMenu>
</nav>
</SidebarGroup>
</template>
+11 -5
View File
@@ -2,13 +2,19 @@
import type { HTMLAttributes } from "vue";
import { cn } from "@/lib/utils";
const props = defineProps<{
class?: HTMLAttributes["class"];
}>();
const props = withDefaults(
defineProps<{
class?: HTMLAttributes["class"];
/** The heading level, so pages keep a real heading structure. */
as?: string;
}>(),
{ as: "h2" },
);
</script>
<template>
<div
<component
:is="props.as"
data-slot="card-title"
:class="
cn(
@@ -18,5 +24,5 @@ const props = defineProps<{
"
>
<slot />
</div>
</component>
</template>
+11 -5
View File
@@ -2,18 +2,24 @@
import type { HTMLAttributes } from "vue";
import { cn } from "@/lib/utils";
const props = defineProps<{
class?: HTMLAttributes["class"];
}>();
const props = withDefaults(
defineProps<{
class?: HTMLAttributes["class"];
/** The heading level, so pages keep a real heading structure. */
as?: string;
}>(),
{ as: "h2" },
);
</script>
<template>
<div
<component
:is="props.as"
data-slot="empty-title"
:class="
cn('text-label font-medium tracking-tight cn-font-heading', props.class)
"
>
<slot />
</div>
</component>
</template>
+1 -1
View File
@@ -28,7 +28,7 @@ const props = defineProps<{
<template>
<Card :class="cn('mb-4', props.edited && 'ring-primary/60', props.class)">
<CardHeader v-if="title || description || $slots.action">
<CardTitle v-if="title">{{ title }}</CardTitle>
<CardTitle v-if="title" as="h2">{{ title }}</CardTitle>
<CardDescription v-if="description">{{ description }}</CardDescription>
<CardAction v-if="$slots.action"><slot name="action" /></CardAction>
</CardHeader>