Skip to content

Commit 0286a01

Browse files
committed
✨(frontend) improve accessibility of cdoc content with correct aria tags
added appropriate aria attributes and semantic tags to enhance accessibility Signed-off-by: Cyril <[email protected]>
1 parent e07f709 commit 0286a01

File tree

11 files changed

+46
-21
lines changed

11 files changed

+46
-21
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ and this project adheres to
1616
- #1255
1717
- #1262
1818
- #1270
19+
- #1271
1920

2021
## [3.5.0] - 2025-07-31
2122

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

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,13 @@ test.describe('Doc Create', () => {
4545
})
4646
.click();
4747

48-
const input = page.getByRole('textbox', { name: 'doc title input' });
49-
await expect(input).toHaveText('');
48+
await page.waitForURL('**/docs/**', {
49+
timeout: 10000,
50+
waitUntil: 'domcontentloaded',
51+
});
52+
53+
const input = page.getByRole('textbox', { name: /^Document title/i });
54+
await expect(input).toHaveText(/^(?:Untitled document)?$/);
5055
await expect(
5156
page.locator('.c__tree-view--row-content').getByText('Untitled document'),
5257
).toBeVisible();
@@ -67,8 +72,13 @@ test.describe('Doc Create', () => {
6772
.getByText('New sub-doc')
6873
.click();
6974

70-
const input = page.getByRole('textbox', { name: 'doc title input' });
71-
await expect(input).toHaveText('');
75+
await page.waitForURL('**/docs/**', {
76+
timeout: 10000,
77+
waitUntil: 'domcontentloaded',
78+
});
79+
80+
const input = page.getByRole('textbox', { name: /^Document title/i });
81+
await expect(input).toHaveText(/^(?:Untitled document)?$/);
7282
await expect(
7383
page.locator('.c__tree-view--row-content').getByText('Untitled document'),
7484
).toBeVisible();

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@ test.describe('Doc Export', () => {
448448
waitUntil: 'domcontentloaded',
449449
});
450450

451-
const input = page.getByLabel('doc title input');
451+
const input = page.getByRole('textbox', { name: /^Document title/i });
452452
await expect(input).toBeVisible();
453453
await expect(input).toHaveText('');
454454
await input.click();

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ test.describe('Doc Header', () => {
2525
'It is the card information about the document.',
2626
);
2727

28-
const docTitle = card.getByRole('textbox', { name: 'doc title input' });
28+
const docTitle = card.getByRole('textbox', { name: /^Document title/i });
2929
await expect(docTitle).toBeVisible();
3030

3131
await page.getByRole('button', { name: 'Share' }).click();
@@ -52,7 +52,7 @@ test.describe('Doc Header', () => {
5252

5353
test('it updates the title doc', async ({ page, browserName }) => {
5454
await createDoc(page, 'doc-update', browserName, 1);
55-
const docTitle = page.getByRole('textbox', { name: 'doc title input' });
55+
const docTitle = page.getByRole('textbox', { name: /^Document title/i });
5656
await expect(docTitle).toBeVisible();
5757
await docTitle.fill('Hello World');
5858
await docTitle.blur();

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ test.describe('Doc Tree', () => {
5151
await expect(subPageItem).toBeVisible();
5252
await subPageItem.click();
5353
await verifyDocName(page, '');
54-
const input = page.getByRole('textbox', { name: 'doc title input' });
54+
const input = page.getByRole('textbox', { name: /^Document title/i });
5555
await input.click();
5656
const [randomDocName] = randomName('doc-tree-test', browserName, 1);
5757
await input.fill(randomDocName);
@@ -197,7 +197,7 @@ test.describe('Doc Tree', () => {
197197
await page.getByText('Move to my docs').click();
198198

199199
await expect(
200-
page.getByRole('textbox', { name: 'doc title input' }),
200+
page.getByRole('textbox', { name: /^Document title/i }),
201201
).not.toHaveText(docChild);
202202

203203
const header = page.locator('header').first();

src/frontend/apps/e2e/__tests__/app-impress/utils-common.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,8 @@ export const createDoc = async (
101101
waitUntil: 'networkidle',
102102
});
103103

104-
const input = page.getByLabel('doc title input');
104+
const input = page.getByRole('textbox', { name: /^Document title/i });
105105
await expect(input).toBeVisible();
106-
await expect(input).toHaveText('');
107106
await input.click();
108107

109108
await input.fill(randomDocs[i]);
@@ -122,7 +121,7 @@ export const verifyDocName = async (page: Page, docName: string) => {
122121

123122
try {
124123
await expect(
125-
page.getByRole('textbox', { name: 'doc title input' }),
124+
page.getByRole('textbox', { name: /^Document title/i }),
126125
).toHaveText(docName);
127126
} catch {
128127
await expect(page.getByRole('heading', { name: docName })).toBeVisible();
@@ -180,9 +179,8 @@ export const goToGridDoc = async (
180179
};
181180

182181
export const updateDocTitle = async (page: Page, title: string) => {
183-
const input = page.getByLabel('doc title input');
182+
const input = page.getByRole('textbox', { name: /^Document title/i });
184183
await expect(input).toBeVisible();
185-
await expect(input).toHaveText('');
186184
await input.click();
187185
await input.fill(title);
188186
await input.click();

src/frontend/apps/impress/src/features/docs/doc-header/components/DocTitle.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ const DocTitleInput = ({ doc }: DocTitleProps) => {
107107
}, [doc]);
108108

109109
return (
110-
<Tooltip content={t('Rename')} placement="top">
110+
<Tooltip content={t('Rename')} aria-hidden={true} placement="top">
111111
<Box
112112
as="span"
113113
role="textbox"
@@ -116,7 +116,8 @@ const DocTitleInput = ({ doc }: DocTitleProps) => {
116116
defaultValue={titleDisplay || undefined}
117117
onKeyDownCapture={handleKeyDown}
118118
suppressContentEditableWarning={true}
119-
aria-label="doc title input"
119+
aria-label={`${t('Document title')} ${doc.title || untitledDocument}`}
120+
aria-multiline={false}
120121
onBlurCapture={(event) =>
121122
handleTitleSubmit(event.target.textContent || '')
122123
}
@@ -137,7 +138,7 @@ const DocTitleInput = ({ doc }: DocTitleProps) => {
137138
outline: none;
138139
`}
139140
>
140-
{titleDisplay}
141+
{titleDisplay || untitledDocument}
141142
</Box>
142143
</Tooltip>
143144
);

src/frontend/apps/impress/src/features/docs/doc-header/components/DocToolBox.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ export const DocToolBox = ({ doc }: DocToolBoxProps) => {
215215
>
216216
<Button
217217
color="tertiary"
218-
aria-label="Share button"
218+
aria-label={t('Share button')}
219219
icon={
220220
<Icon iconName="group" $theme="primary" $variation="800" />
221221
}
@@ -235,12 +235,18 @@ export const DocToolBox = ({ doc }: DocToolBoxProps) => {
235235
<Button
236236
color="tertiary-text"
237237
icon={
238-
<Icon iconName="download" $theme="primary" $variation="800" />
238+
<Icon
239+
iconName="download"
240+
$theme="primary"
241+
$variation="800"
242+
aria-hidden={true}
243+
/>
239244
}
240245
onClick={() => {
241246
setIsModalExportOpen(true);
242247
}}
243248
size={isSmallMobile ? 'small' : 'medium'}
249+
aria-label={t('Download the document')}
244250
/>
245251
)}
246252
<DropdownMenu options={options}>

src/frontend/apps/impress/src/features/docs/doc-management/components/SimpleDocItem.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ export const SimpleDocItem = ({
7171
<Box $justify="center" $overflow="auto">
7272
<Text
7373
aria-describedby="doc-title"
74-
aria-label={doc.title}
74+
aria-label={doc.title || untitledDocument}
7575
$size="sm"
7676
$variation="1000"
7777
$weight="500"

src/frontend/apps/impress/src/features/docs/doc-share/components/DocRoleDropdown.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ export const DocRoleDropdown = ({
102102

103103
if (!canUpdate) {
104104
return (
105-
<Text aria-label="doc-role-text" $variation="600">
105+
<Text aria-label={t('Document role text')} $variation="600">
106106
{transRole(currentRole)}
107107
</Text>
108108
);

0 commit comments

Comments
 (0)