Skip to content

Commit 70e94ad

Browse files
committed
fixup! ✨(frontend) make components accessible to screen readers
1 parent e509cb3 commit 70e94ad

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

src/frontend/apps/impress/src/components/DropdownMenu.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { css } from 'styled-components';
1111

1212
import { Box, BoxButton, BoxProps, DropButton, Icon, Text } from '@/components';
1313
import { useCunninghamTheme } from '@/cunningham';
14-
import { useDropdownKeyboardNav } from '@/features/docs/doc-tree/hooks/useDropdownKeyboardNav';
14+
import { useDropdownKeyboardNav } from '@/hook/useDropdownKeyboardNav';
1515

1616
export type DropdownMenuOption = {
1717
icon?: string;

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { useCunninghamTheme } from '@/cunningham';
1313
import { Doc, useTrans } from '@/features/docs/doc-management';
1414
import { useActionableMode } from '@/features/docs/doc-tree/hooks/useActionableMode';
1515
import { useLeftPanelStore } from '@/features/left-panel';
16+
import { useDropdownKeyboardNav } from '@/hook/useDropdownKeyboardNav';
1617
import { useResponsiveStore } from '@/stores';
1718

1819
import { useKeyboardActivation } from '../hooks/useKeyboardActivation';
@@ -82,6 +83,14 @@ export const DocSubPageItem = (props: TreeViewNodeProps<Doc>) => {
8283
};
8384

8485
useKeyboardActivation(['Enter', ' '], isActive, handleActivate, true);
86+
useDropdownKeyboardNav({
87+
isOpen: menuOpen,
88+
focusedIndex: 0,
89+
options: [],
90+
menuItemRefs: { current: [] as HTMLDivElement[] },
91+
setFocusedIndex: () => {},
92+
onOpenChange: setMenuOpen,
93+
});
8594

8695
// prepare the text for the screen reader
8796
const docTitle = doc.title || untitledDocument;
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
// src/features/docs/doc-tree/hooks/useDropdownKeyboardNav.ts
21
import { RefObject, useEffect } from 'react';
32

43
import { DropdownMenuOption } from '@/components/DropdownMenu';
54

6-
import { useKeyboardActivation } from './useKeyboardActivation';
5+
import { useKeyboardActivation } from '../features/docs/doc-tree/hooks/useKeyboardActivation';
76

87
type UseDropdownKeyboardNavProps = {
98
isOpen: boolean;

0 commit comments

Comments
 (0)