Skip to content

Commit a68fa01

Browse files
committed
fixup! ✨(frontend) make components accessible to screen readers
1 parent de84160 commit a68fa01

File tree

2 files changed

+4
-11
lines changed

2 files changed

+4
-11
lines changed

src/frontend/apps/impress/src/features/docs/doc-tree/components/DocSubPageItem.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,11 @@ import { Box, BoxButton, Icon, Text } from '@/components';
1212
import { useCunninghamTheme } from '@/cunningham';
1313
import { Doc, useTrans } from '@/features/docs/doc-management';
1414
import { useActionableMode } from '@/features/docs/doc-tree/hooks/useActionableMode';
15-
import { useTreeItemKeyboardActivate } from '@/features/docs/doc-tree/hooks/useTreeItemKeyboardActivate';
1615
import { useLeftPanelStore } from '@/features/left-panel';
1716
import { useResponsiveStore } from '@/stores';
1817

18+
import { useKeyboardActivation } from '../hooks/useKeyboardActivation';
19+
1920
import SubPageIcon from './../assets/sub-page-logo.svg';
2021
import { DocTreeItemActions } from './DocTreeItemActions';
2122

@@ -80,7 +81,7 @@ export const DocSubPageItem = (props: TreeViewNodeProps<Doc>) => {
8081
}
8182
};
8283

83-
useTreeItemKeyboardActivate(isActive, handleActivate);
84+
useKeyboardActivation(['Enter', ' '], isActive, handleActivate, true);
8485

8586
// prepare the text for the screen reader
8687
const docTitle = doc.title || untitledDocument;
@@ -151,14 +152,14 @@ export const DocSubPageItem = (props: TreeViewNodeProps<Doc>) => {
151152
e.stopPropagation();
152153
handleActivate();
153154
}}
155+
tabIndex={-1}
154156
$width="100%"
155157
$direction="row"
156158
$gap={spacingsTokens['xs']}
157159
$align="center"
158160
$minHeight="24px"
159161
data-testid={`doc-sub-page-item-${doc.id}`}
160162
aria-label={`${t('Open document')} ${docTitle}`}
161-
role="button"
162163
>
163164
<Box $width="16px" $height="16px" aria-hidden="true">
164165
<SubPageIcon />

src/frontend/apps/impress/src/features/docs/doc-tree/hooks/useTreeItemKeyboardActivate.tsx

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)