Skip to content

Commit 63c2184

Browse files
committed
refactor: simplify defaultOpen handling and enhance sidebar accessibility with titles and descriptions
1 parent 031e128 commit 63c2184

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

services/frontend/src/components/DashboardLayout.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script setup lang="ts">
2-
import { computed, ref } from 'vue' // Added ref
2+
import { computed } from 'vue'
33
import type { StyleValue } from 'vue'
44
import { SidebarProvider, SidebarInset, SidebarTrigger } from '@/components/ui/sidebar' // Assuming SidebarTrigger might be needed
55
import AppSidebar from '@/components/AppSidebar.vue'
@@ -11,7 +11,7 @@ const props = defineProps<Props>()
1111
1212
// TODO: Implement cookie-based persistence for defaultOpen if needed, like in the shadcn/ui example.
1313
// For now, defaulting to true.
14-
const defaultOpen = ref(true)
14+
const defaultOpen = true
1515
1616
// Define sidebar width using custom values
1717
// Override the collapsed width to 30rem for testing

services/frontend/src/components/ui/sidebar/Sidebar.vue

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<script setup lang="ts">
22
import type { SidebarProps } from '.'
33
import { cn } from '@/lib/utils'
4-
import { Sheet, SheetContent } from '@/components/ui/sheet'
4+
import { Sheet, SheetContent, SheetTitle, SheetDescription } from '@/components/ui/sheet'
55
import { SIDEBAR_WIDTH_MOBILE, useSidebar } from './utils'
66
77
defineOptions({
@@ -31,11 +31,13 @@ const { isMobile, state, openMobile, setOpenMobile } = useSidebar()
3131
data-sidebar="sidebar"
3232
data-mobile="true"
3333
:side="side"
34-
class="w-[--sidebar-width] bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden"
34+
class="w-[--sidebar-width] !bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden"
3535
:style="{
3636
'--sidebar-width': SIDEBAR_WIDTH_MOBILE,
3737
}"
3838
>
39+
<SheetTitle class="sr-only">Navigation Sidebar</SheetTitle>
40+
<SheetDescription class="sr-only">Main navigation menu for the application</SheetDescription>
3941
<div class="flex h-full w-full flex-col">
4042
<slot />
4143
</div>

0 commit comments

Comments
 (0)