Skip to content

Commit e92fa58

Browse files
committed
fixup! ✨(frontend) improve accessibility of cdoc content with correct aria tags
1 parent 559b869 commit e92fa58

File tree

5 files changed

+15
-14
lines changed

5 files changed

+15
-14
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ test.describe('Doc Create', () => {
5050
waitUntil: 'domcontentloaded',
5151
});
5252

53-
const input = page.getByRole('textbox', { name: /^Document title/i });
54-
await expect(input).toHaveText(/^(?:Untitled document)?$/);
53+
const input = page.getByRole('textbox', { name: 'Document title' });
54+
await expect(input).toHaveText('');
5555
await expect(
5656
page.locator('.c__tree-view--row-content').getByText('Untitled document'),
5757
).toBeVisible();
@@ -77,8 +77,8 @@ test.describe('Doc Create', () => {
7777
waitUntil: 'domcontentloaded',
7878
});
7979

80-
const input = page.getByRole('textbox', { name: /^Document title/i });
81-
await expect(input).toHaveText(/^(?:Untitled document)?$/);
80+
const input = page.getByRole('textbox', { name: 'Document title' });
81+
await expect(input).toHaveText('');
8282
await expect(
8383
page.locator('.c__tree-view--row-content').getByText('Untitled document'),
8484
).toBeVisible();

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: /^Document title/i });
28+
const docTitle = card.getByRole('textbox', { name: 'Document title' });
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: /^Document title/i });
55+
const docTitle = page.getByRole('textbox', { name: 'Document title' });
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: /^Document title/i });
54+
const input = page.getByRole('textbox', { name: 'Document title' });
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: /^Document title/i }),
200+
page.getByRole('textbox', { name: 'Document title' }),
201201
).not.toHaveText(docChild);
202202

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

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

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

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

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

122122
try {
123123
await expect(
124-
page.getByRole('textbox', { name: /^Document title/i }),
124+
page.getByRole('textbox', { name: 'Document title' }),
125125
).toHaveText(docName);
126126
} catch {
127127
await expect(page.getByRole('heading', { name: docName })).toBeVisible();
@@ -179,7 +179,8 @@ export const goToGridDoc = async (
179179
};
180180

181181
export const updateDocTitle = async (page: Page, title: string) => {
182-
const input = page.getByRole('textbox', { name: /^Document title/i });
182+
const input = page.getByRole('textbox', { name: 'Document title' });
183+
await expect(input).toHaveText('');
183184
await expect(input).toBeVisible();
184185
await input.click();
185186
await input.fill(title);

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ const DocTitleInput = ({ doc }: DocTitleProps) => {
116116
defaultValue={titleDisplay || undefined}
117117
onKeyDownCapture={handleKeyDown}
118118
suppressContentEditableWarning={true}
119-
aria-label={`${t('Document title')} ${doc.title || untitledDocument}`}
119+
aria-label={`${t('Document title')}`}
120120
aria-multiline={false}
121121
onBlurCapture={(event) =>
122122
handleTitleSubmit(event.target.textContent || '')
@@ -138,7 +138,7 @@ const DocTitleInput = ({ doc }: DocTitleProps) => {
138138
outline: none;
139139
`}
140140
>
141-
{titleDisplay || untitledDocument}
141+
{titleDisplay}
142142
</Box>
143143
</Tooltip>
144144
);

0 commit comments

Comments
 (0)