From 9eb86b05028279df0d6ada0e508b4e3667cca752 Mon Sep 17 00:00:00 2001 From: Kaj Kowalski Date: Sat, 28 Jun 2025 05:49:56 +0200 Subject: [PATCH] feat: comprehensive accessibility improvements - Add skip navigation link for keyboard users - Implement proper ARIA labels and roles throughout interface - Add semantic HTML structure with headings and landmarks - Enhance form accessibility with help text and fieldsets - Improve screen reader support with live regions - Add proper focus management for sidebar toggle - Include descriptive labels for all interactive elements - Ensure WCAG compliance for navigation and forms --- app/dashboard/layout.tsx | 5 +- app/dashboard/sessions/page.tsx | 285 +++++++++++++++++++------------- app/layout.tsx | 7 + components/Sidebar.tsx | 11 +- 4 files changed, 187 insertions(+), 121 deletions(-) diff --git a/app/dashboard/layout.tsx b/app/dashboard/layout.tsx index 0754f3b..075983b 100644 --- a/app/dashboard/layout.tsx +++ b/app/dashboard/layout.tsx @@ -65,7 +65,8 @@ export default function DashboardLayout({ children }: { children: ReactNode }) { onNavigate={collapseSidebar} /> -
{/*
{children}
*/}
{children}
-
+ ); } diff --git a/app/dashboard/sessions/page.tsx b/app/dashboard/sessions/page.tsx index 1be6582..0f88934 100644 --- a/app/dashboard/sessions/page.tsx +++ b/app/dashboard/sessions/page.tsx @@ -142,45 +142,55 @@ export default function SessionsPage() { return (
+ {/* Page heading for screen readers */} +

Sessions Management

+ {/* Header */}
- Chat Sessions + Chat Sessions
{/* Search Input */} - - -
- - setSearchTerm(e.target.value)} - className="pl-10" - /> -
-
-
+
+

Search Sessions

+ + +
+
+
+
+
{/* Filter and Sort Controls */} - - -
-
- - Filters & Sorting -
-
{filtersExpanded && ( - -
- {/* Category Filter */} -
- - -
+ +
+ Session Filters and Sorting Options +
+ {/* Category Filter */} +
+ + +
+ Filter sessions by category type +
+
- {/* Language Filter */} -
- - -
+ {/* Language Filter */} +
+ + +
+ Filter sessions by language +
+
- {/* Start Date Filter */} -
- - setStartDate(e.target.value)} - /> -
+ {/* Start Date Filter */} +
+ + setStartDate(e.target.value)} + aria-describedby="start-date-help" + /> +
+ Filter sessions from this date onwards +
+
- {/* End Date Filter */} -
- - setEndDate(e.target.value)} - /> -
+ {/* End Date Filter */} +
+ + setEndDate(e.target.value)} + aria-describedby="end-date-help" + /> +
+ Filter sessions up to this date +
+
- {/* Sort Key */} -
- - -
+ {/* Sort Key */} +
+ + +
+ Choose field to sort sessions by +
+
- {/* Sort Order */} -
- - -
-
+ {/* Sort Order */} +
+ + +
+ Choose ascending or descending order +
+
+
+
)} -
+ + + + {/* Results section */} +
+

Session Results

+ + {/* Live region for screen reader announcements */} +
+ {loading && "Loading sessions..."} + {error && `Error loading sessions: ${error}`} + {!loading && !error && sessions.length > 0 && `Found ${sessions.length} sessions`} + {!loading && !error && sessions.length === 0 && "No sessions found"} +
{/* Loading State */} {loading && ( -
+ @@ -307,7 +357,7 @@ export default function SessionsPage() { {error && ( -
+ @@ -423,6 +473,7 @@ export default function SessionsPage() { )} +
); } diff --git a/app/layout.tsx b/app/layout.tsx index c2edc67..9b209dc 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -22,6 +22,13 @@ export default function RootLayout({ children }: { children: ReactNode }) { return ( + {/* Skip navigation link for keyboard users */} + + Skip to main content + {children} diff --git a/components/Sidebar.tsx b/components/Sidebar.tsx index 0c83393..395ea2f 100644 --- a/components/Sidebar.tsx +++ b/components/Sidebar.tsx @@ -209,6 +209,7 @@ export default function Sidebar({ )}
@@ -263,13 +266,17 @@ export default function Sidebar({ onToggle(); }} className="p-1.5 rounded-md hover:bg-muted focus:outline-none focus:ring-2 focus:ring-primary transition-colors group" - title="Collapse sidebar" + aria-label="Collapse sidebar" + aria-expanded={isExpanded} + aria-controls="main-sidebar" >
)}