Skip to content

Commit 51a37fd

Browse files
committed
fixup! ✨(frontend) improve NVDA navigation in DocShareModal
1 parent ea3605a commit 51a37fd

File tree

4 files changed

+10
-11
lines changed

4 files changed

+10
-11
lines changed

src/frontend/apps/e2e/__tests__/app-impress/doc-editor.spec.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -763,9 +763,8 @@ test.describe('Doc Editor', () => {
763763
await expect(searchContainer.getByText(docChild2)).toBeVisible();
764764
await expect(searchContainer.getByText(randomDoc)).toBeHidden();
765765

766-
// use keydown to select the second result
767-
await page.keyboard.press('ArrowDown');
768-
await page.keyboard.press('Enter');
766+
// Click directly on the second result instead of using keyboard navigation
767+
await searchContainer.getByText(docChild2).click();
769768

770769
// Wait for the search container to disappear, indicating selection was made
771770
await expect(searchContainer).toBeHidden();

src/frontend/apps/e2e/__tests__/app-impress/doc-member-create.spec.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,9 @@ test.describe('Document create member', () => {
118118

119119
await page.getByRole('button', { name: 'Share' }).click();
120120

121-
const inputSearch = page.getByTestId('quick-search-input');
121+
const inputSearch = page.getByRole('combobox', {
122+
name: 'Quick search input',
123+
});
122124

123125
const [email] = randomName('[email protected]', browserName, 1);
124126
await inputSearch.fill(email);
@@ -166,7 +168,9 @@ test.describe('Document create member', () => {
166168

167169
await page.getByRole('button', { name: 'Share' }).click();
168170

169-
const inputSearch = page.getByTestId('quick-search-input');
171+
const inputSearch = page.getByRole('combobox', {
172+
name: 'Quick search input',
173+
});
170174

171175
const email = randomName('[email protected]', browserName, 1)[0];
172176
await inputSearch.fill(email);

src/frontend/apps/impress/src/components/quick-search/QuickSearch.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,10 @@ export const QuickSearch = ({
4444
}: PropsWithChildren<QuickSearchProps>) => {
4545
const ref = useRef<HTMLDivElement | null>(null);
4646
const listId = useId();
47-
const hasResults = Boolean(children);
4847
const NO_SELECTION_VALUE = '__none__';
4948
const [userInteracted, setUserInteracted] = useState(false);
5049
const [selectedValue, setSelectedValue] = useState(NO_SELECTION_VALUE);
51-
const isExpanded = userInteracted && hasResults;
50+
const isExpanded = userInteracted;
5251

5352
const handleValueChange = (val: string) => {
5453
if (userInteracted) {
@@ -82,7 +81,6 @@ export const QuickSearch = ({
8281
onFilter={onFilter}
8382
placeholder={placeholder}
8483
listId={listId}
85-
hasResults={hasResults}
8684
isExpanded={isExpanded}
8785
onUserInteract={handleUserInteract}
8886
>

src/frontend/apps/impress/src/components/quick-search/QuickSearchInput.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ type Props = {
1717
children?: ReactNode;
1818
withSeparator?: boolean;
1919
listId?: string;
20-
hasResults?: boolean;
2120
onUserInteract?: () => void;
2221
isExpanded?: boolean;
2322
};
@@ -29,7 +28,6 @@ export const QuickSearchInput = ({
2928
children,
3029
withSeparator: separator = true,
3130
listId,
32-
hasResults,
3331
onUserInteract,
3432
isExpanded,
3533
}: Props) => {
@@ -65,7 +63,7 @@ export const QuickSearchInput = ({
6563
<Command.Input
6664
autoFocus={true}
6765
aria-label={t('Quick search input')}
68-
aria-expanded={isExpanded ?? hasResults}
66+
aria-expanded={isExpanded}
6967
aria-controls={listId}
7068
onClick={(e) => {
7169
e.stopPropagation();

0 commit comments

Comments
 (0)