Skip to content

Commit ee5703e

Browse files
committed
♿️(frontend) align search modal field label with placeholder
Remove redundant aria-label on QuickSearch input, align DocSearchModal labels.
1 parent a78269a commit ee5703e

7 files changed

Lines changed: 20 additions & 10 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ and this project adheres to
2626
- ♿️(frontend) add aria-hidden to decorative avatar SVGs in share modal #2324
2727
- 🏗️(frontend) move comments to its own folder feature #2374
2828
- ♿️(frontend) align mobile header menu aria-label i18n pattern #2377
29+
- ♿️(frontend) align search modal field label with placeholder #2384
2930

3031
### Fixed
3132

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ test.describe('Doc grid move', () => {
211211
page.getByRole('dialog').getByRole('heading', { name: 'Move' }),
212212
).toBeVisible();
213213

214-
const input = page.getByRole('combobox', { name: 'Quick search input' });
214+
const input = page.getByRole('combobox', { name: 'Search for a doc' });
215215
await input.click();
216216
await input.fill(titleDoc2);
217217

@@ -299,7 +299,7 @@ test.describe('Doc grid move', () => {
299299
page.getByRole('dialog').getByRole('heading', { name: 'Move' }),
300300
).toBeVisible();
301301

302-
const input = page.getByRole('combobox', { name: 'Quick search input' });
302+
const input = page.getByRole('combobox', { name: 'Search for a doc' });
303303
await input.click();
304304
await input.fill(titleDoc2);
305305

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

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ test.describe('Document search', () => {
107107

108108
await searchButton.click();
109109
await expect(
110-
page.getByRole('combobox', { name: 'Search documents' }),
110+
page.getByRole('combobox', { name: 'Type the name of a document' }),
111111
).toBeVisible();
112112
await expect(filters).toBeHidden();
113113

@@ -120,7 +120,7 @@ test.describe('Document search', () => {
120120

121121
await searchButton.click();
122122
await expect(
123-
page.getByRole('combobox', { name: 'Search documents' }),
123+
page.getByRole('combobox', { name: 'Type the name of a document' }),
124124
).toBeVisible();
125125
await expect(filters).toBeHidden();
126126

@@ -168,9 +168,11 @@ test.describe('Document search', () => {
168168
const searchButton = page.getByTestId('search-docs-button');
169169

170170
await searchButton.click();
171-
await page.getByRole('combobox', { name: 'Search documents' }).click();
172171
await page
173-
.getByRole('combobox', { name: 'Search documents' })
172+
.getByRole('combobox', { name: 'Type the name of a document' })
173+
.click();
174+
await page
175+
.getByRole('combobox', { name: 'Type the name of a document' })
174176
.fill('sub page search');
175177

176178
// Expect to find the first and second docs in the results list
@@ -192,7 +194,7 @@ test.describe('Document search', () => {
192194
);
193195
await searchButton.click();
194196
await page
195-
.getByRole('combobox', { name: 'Search documents' })
197+
.getByRole('combobox', { name: 'Type the name of a document' })
196198
.fill('second');
197199

198200
// Now there is a sub page - expect to have the focus on the current doc

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ export type QuickSearchProps = {
3131
showInput?: boolean;
3232
loading?: boolean;
3333
label?: string;
34+
listLabel?: string;
3435
placeholder?: string;
3536
groupKey?: string;
3637
beforeList?: ReactNode;
@@ -43,6 +44,7 @@ export const QuickSearch = ({
4344
inputValue,
4445
showInput = true,
4546
label,
47+
listLabel,
4648
placeholder,
4749
beforeList,
4850
children,
@@ -74,7 +76,11 @@ export const QuickSearch = ({
7476
</QuickSearchInput>
7577
)}
7678
{beforeList}
77-
<Command.List id={listId} aria-label={label} role="listbox">
79+
<Command.List
80+
id={listId}
81+
aria-label={listLabel ?? label}
82+
role="listbox"
83+
>
7884
<Box>{children}</Box>
7985
</Command.List>
8086
</Command>

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ export const QuickSearchInput = ({
5555
<Command.Input
5656
ref={inputRef}
5757
autoFocus={true}
58-
aria-label={t('Quick search input')}
5958
aria-controls={listId}
6059
value={inputValue}
6160
role="combobox"

src/frontend/apps/impress/src/features/docs/doc-search/components/DocSearchModal.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,8 @@ const DocSearchModalGlobal = ({
9797
/>
9898
</Box>
9999
<QuickSearch
100-
label={t('Search documents')}
100+
label={t('Type the name of a document')}
101+
listLabel={t('Search results')}
101102
placeholder={t('Type the name of a document')}
102103
loading={loading}
103104
onFilter={handleInputSearch}

src/frontend/apps/impress/src/features/docs/docs-grid/components/DocMoveModal.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,7 @@ export const DocMoveModal = ({
210210
}}
211211
>
212212
<QuickSearch
213+
label={t('Search for a doc')}
213214
placeholder={t('Search for a doc')}
214215
loading={loading}
215216
onFilter={handleInputSearch}

0 commit comments

Comments
 (0)