Skip to content

Commit c3176d6

Browse files
committed
⚡️(frontend) add correct attributes to decorative and interactive icons
Add aria-hidden and aria-label to improve screen reader accessibility Signed-off-by: Cyril <c.gromoff@gmail.com>
1 parent 1cdb6b6 commit c3176d6

File tree

13 files changed

+43
-16
lines changed

13 files changed

+43
-16
lines changed

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@ and this project adheres to
3131
- ♻️(frontend) redirect to doc after duplicate #1175
3232
- 🔧(project) change env.d system by using local files #1200
3333
- ⚡️(frontend) improve tree stability #1207
34-
- ⚡️(frontend) improve accessibility #1232
34+
- ⚡️(frontend) improve accessibility
35+
- #1232
36+
- #1255
3537
- 🛂(frontend) block drag n drop when not desktop #1239
3638

3739
### Fixed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { expect, test } from '@playwright/test';
33
test.beforeEach(async ({ page }) => {
44
await page.goto('/');
55
await expect(
6-
page.locator('header').first().locator('h2').getByText('Docs'),
6+
page.locator('header').first().locator('h1').getByText('Docs'),
77
).toBeVisible();
88
await page.goto('unknown-page404');
99
});

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ test.describe('Doc Create', () => {
2222
);
2323

2424
const header = page.locator('header').first();
25-
await header.locator('h2').getByText('Docs').click();
25+
await header.locator('h1').getByText('Docs').click();
2626

2727
const docsGrid = page.getByTestId('docs-grid');
2828
await expect(docsGrid).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
@@ -429,7 +429,7 @@ test.describe('Doc Export', () => {
429429
await page.waitForLoadState('domcontentloaded');
430430

431431
const header = page.locator('header').first();
432-
await header.locator('h2').getByText('Docs').click();
432+
await header.locator('h1').getByText('Docs').click();
433433

434434
const randomDocFrench = randomName(
435435
'doc-language-export-french',

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ test.describe('Doc grid dnd', () => {
88
await page.goto('/');
99
const header = page.locator('header').first();
1010
await createDoc(page, 'Draggable doc', browserName, 1);
11-
await header.locator('h2').getByText('Docs').click();
11+
await header.locator('h1').getByText('Docs').click();
1212
await createDoc(page, 'Droppable doc', browserName, 1);
13-
await header.locator('h2').getByText('Docs').click();
13+
await header.locator('h1').getByText('Docs').click();
1414

1515
const response = await page.waitForResponse(
1616
(response) =>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ test.describe('Header', () => {
1212

1313
const header = page.locator('header').first();
1414

15-
await expect(header.getByLabel('Docs Logo')).toBeVisible();
15+
await expect(header.getByLabel('Back to homepage')).toBeVisible();
1616
await expect(header.locator('h2').getByText('Docs')).toHaveCSS(
1717
'font-family',
1818
/Roboto/i,

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ export const goToGridDoc = async (
154154
{ nthRow = 1, title }: GoToGridDocOptions = {},
155155
) => {
156156
const header = page.locator('header').first();
157-
await header.locator('h2').getByText('Docs').click();
157+
await header.locator('h1').getByText('Docs').click();
158158

159159
const docsGrid = page.getByTestId('docs-grid');
160160
await expect(docsGrid).toBeVisible();

src/frontend/apps/impress/src/features/header/components/Header.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,11 @@ export const Header = () => {
4949
$margin={{ top: 'auto' }}
5050
>
5151
<IconDocs
52-
aria-label={t('Docs Logo')}
52+
aria-label={t('Back to homepage')}
5353
width={32}
5454
color={colorsTokens['primary-text']}
5555
/>
56-
<Title />
56+
<Title headingLevel="h1" />
5757
</Box>
5858
</StyledLink>
5959
{!isDesktop ? (

src/frontend/apps/impress/src/features/header/components/Title.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@ import { useTranslation } from 'react-i18next';
33
import { Box, Text } from '@/components/';
44
import { useCunninghamTheme } from '@/cunningham';
55

6-
export const Title = () => {
6+
type TitleSemanticsProps = {
7+
headingLevel?: 'h1' | 'h2' | 'h3';
8+
};
9+
10+
export const Title = ({ headingLevel = 'h2' }: TitleSemanticsProps) => {
711
const { t } = useTranslation();
812
const { spacingsTokens, colorsTokens } = useCunninghamTheme();
913

@@ -16,7 +20,7 @@ export const Title = () => {
1620
>
1721
<Text
1822
$margin="none"
19-
as="h2"
23+
as={headingLevel}
2024
$color={colorsTokens['primary-text']}
2125
$zIndex={1}
2226
$size="1.375rem"

src/frontend/apps/impress/src/features/home/components/HomeBanner.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export default function HomeBanner() {
4848
$gap={spacingsTokens['sm']}
4949
>
5050
<IconDocs
51-
aria-label={t('Docs Logo')}
51+
aria-label={t('Back to homepage')}
5252
width={64}
5353
color={colorsTokens['primary-text']}
5454
/>

0 commit comments

Comments
 (0)