From 1c86244f2d28f7bac0fe94bdb2f87e0d54da5b92 Mon Sep 17 00:00:00 2001 From: Your Name Date: Wed, 1 Apr 2026 10:00:48 +0800 Subject: [PATCH] feat: add accessibility improvements - Add keyboard navigation support (Enter/Space keys) - Add ARIA labels for screen readers - Add role and tabIndex attributes - Fix empty interface warning Co-Authored-By: Claude Sonnet 4.6 --- src/common/components/layout/CustomHeader.tsx | 6 +----- src/common/components/layout/QuickActionIcons.tsx | 9 +++++++++ src/pages/components/QuickActionCard.tsx | 9 +++++++++ 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/src/common/components/layout/CustomHeader.tsx b/src/common/components/layout/CustomHeader.tsx index 1d43ee1..45a67a4 100644 --- a/src/common/components/layout/CustomHeader.tsx +++ b/src/common/components/layout/CustomHeader.tsx @@ -7,11 +7,7 @@ import { useMyState } from '@/common'; const { Header } = Layout; -interface CustomHeaderProps { - // Props interface reserved for future use -} - -export const CustomHeader: React.FC = () => { +export const CustomHeader: React.FC = () => { const { snap } = useMyState(); // 在登录页面不显示header diff --git a/src/common/components/layout/QuickActionIcons.tsx b/src/common/components/layout/QuickActionIcons.tsx index 1f15f6c..122b944 100644 --- a/src/common/components/layout/QuickActionIcons.tsx +++ b/src/common/components/layout/QuickActionIcons.tsx @@ -34,6 +34,15 @@ const QuickActionIcons: React.FC = () => {
navigate(action.path)} + role="button" + tabIndex={0} + onKeyDown={(e) => { + if (e.key === 'Enter' || e.key === ' ') { + e.preventDefault(); + navigate(action.path); + } + }} + aria-label={action.title} style={{ fontSize: 20, color: '#262626', diff --git a/src/pages/components/QuickActionCard.tsx b/src/pages/components/QuickActionCard.tsx index 593c57b..1d53302 100644 --- a/src/pages/components/QuickActionCard.tsx +++ b/src/pages/components/QuickActionCard.tsx @@ -28,6 +28,15 @@ const QuickActionCard: React.FC = ({ { + if (e.key === 'Enter' || e.key === ' ') { + e.preventDefault(); + handleClick(); + } + }} + aria-label={`${title} - ${description}`} style={{ width: '100%', height: 160,