Skip to content

Commit a022a32

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 f5f9d8a commit a022a32

File tree

5 files changed

+32
-7
lines changed

5 files changed

+32
-7
lines changed

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/left-panel/components/LeftPanelHeader.tsx

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { Button } from '@openfun/cunningham-react';
2+
import { t } from 'i18next';
23
import { useRouter } from 'next/router';
34
import { PropsWithChildren, useCallback, useState } from 'react';
45

@@ -54,19 +55,31 @@ export const LeftPanelHeader = ({ children }: PropsWithChildren) => {
5455
<Box $direction="row" $gap="2px">
5556
<Button
5657
onClick={goToHome}
58+
aria-label={t('Back to homepage')}
5759
size="medium"
5860
color="tertiary-text"
5961
icon={
60-
<Icon $variation="800" $theme="primary" iconName="house" />
62+
<Icon
63+
$variation="800"
64+
$theme="primary"
65+
iconName="house"
66+
aria-hidden="true"
67+
/>
6168
}
6269
/>
6370
{authenticated && (
6471
<Button
6572
onClick={openSearchModal}
6673
size="medium"
6774
color="tertiary-text"
75+
aria-label={t('Search docs')}
6876
icon={
69-
<Icon $variation="800" $theme="primary" iconName="search" />
77+
<Icon
78+
$variation="800"
79+
$theme="primary"
80+
iconName="search"
81+
aria-hidden="true"
82+
/>
7083
}
7184
/>
7285
)}

src/frontend/apps/impress/src/features/left-panel/components/LeftPanelHeaderButton.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export const LeftPanelHeaderButton = () => {
2121
<Button
2222
color="primary"
2323
onClick={() => createDoc()}
24-
icon={<Icon $variation="000" iconName="add" />}
24+
icon={<Icon $variation="000" iconName="add" aria-hidden="true" />}
2525
disabled={isDocCreating}
2626
>
2727
{t('New doc')}

src/frontend/apps/impress/src/i18n/translations.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@
178178
"Doc visibility card": "Dokumenten-Sichtbarkeitskarte",
179179
"Docs": "Docs",
180180
"Docs Logo": "Docs-Logo",
181+
"Back to homepage": "Zurück zur Startseite",
181182
"Docs is already available, log in to use it now.": "Docs ist bereits verfügbar. Melden Sie sich an, um es jetzt zu nutzen.",
182183
"Docs makes real-time collaboration simple. Invite collaborators - public officials or external partners - with one click to see their changes live, while maintaining precise access control for data security.": "Docs macht die Zusammenarbeit in Echtzeit einfach. Laden Sie Mitarbeiter — Beamte oder externe Partner — mit einem Klick ein, um ihre Änderungen live zu sehen und dabei die genaue Zugangskontrolle zwecks Datensicherheit beizubehalten.",
183184
"Docs offers an intuitive writing experience. Its minimalist interface favors content over layout, while offering the essentials: media import, offline mode and keyboard shortcuts for greater efficiency.": "Docs bietet ein intuitives Schreiberlebnis. Seine minimalistische Oberfläche bevorzugt Inhalte über Layout, bietet aber das Wesentliche: Medien-Import, Offline-Modus und Tastaturkürzel für mehr Effizienz.",
@@ -278,6 +279,7 @@
278279
"Reset": "Zurücksetzen",
279280
"Restore": "Wiederherstellen",
280281
"Search": "Suchen",
282+
"Search docs": "Dokumente durchsuchen",
281283
"Search modal": "Suche Modal",
282284
"Search user result": "Suchergebnis",
283285
"Select a document": "Dokument auswählen",
@@ -337,6 +339,7 @@
337339
},
338340
"en": {
339341
"translation": {
342+
"Search docs": "Search docs",
340343
"Share with {{count}} users_one": "Share with {{count}} user",
341344
"Shared with {{count}} users_many": "Shared with {{count}} users",
342345
"Shared with {{count}} users_one": "Shared with {{count}} user",
@@ -391,6 +394,7 @@
391394
"Doc visibility card": "Accesos al documento",
392395
"Docs": "Docs",
393396
"Docs Logo": "Logo de Docs",
397+
"Back to homepage": "Volver a la página de inicio",
394398
"Docs is already available, log in to use it now.": "Docs ya está disponible, inicia sesión para empezar a usarlo.",
395399
"Docs makes real-time collaboration simple. Invite collaborators - public officials or external partners - with one click to see their changes live, while maintaining precise access control for data security.": "Docs simplifica la colaboración en tiempo real. Invitar colaboradores - funcionarios públicos o socios externos - con un solo clic para ver sus cambios en vivo, manteniendo un control de acceso preciso para la seguridad de los datos.",
396400
"Docs offers an intuitive writing experience. Its minimalist interface favors content over layout, while offering the essentials: media import, offline mode and keyboard shortcuts for greater efficiency.": "Docs ofrece una experiencia de escritura intuitiva. Su interfaz minimalista favorece el contenido sobre el diseño, mientras ofrece lo esencial: importación de medios, modo sin conexión y atajos de teclado para una mayor eficiencia.",
@@ -476,6 +480,7 @@
476480
"Request access": "Solicitar acceso",
477481
"Restore": "Recuperar",
478482
"Search": "Buscar",
483+
"Search docs": "Buscar documentos",
479484
"Search modal": "Modal de búsqueda",
480485
"Search user result": "Resultado de la búsqueda de usuarios",
481486
"Select a document": "Selecciona un documento",
@@ -581,6 +586,7 @@
581586
"Doc visibility card": "Carte de visibilité du doc",
582587
"Docs": "Docs",
583588
"Docs Logo": "Logo Docs",
589+
"Back to homepage": "Retour page d'accueil",
584590
"Docs is already available, log in to use it now.": "Docs est déjà disponible, connectez-vous pour l’utiliser dès maintenant.",
585591
"Docs makes real-time collaboration simple. Invite collaborators - public officials or external partners - with one click to see their changes live, while maintaining precise access control for data security.": "Docs simplifie la collaboration en temps réel. Invitez des collaborateurs - agents publics ou partenaires externes - d'un clic pour voir leurs modifications en direct, tout en gardant un contrôle précis des accès pour la sécurité des données.",
586592
"Docs offers an intuitive writing experience. Its minimalist interface favors content over layout, while offering the essentials: media import, offline mode and keyboard shortcuts for greater efficiency.": "Docs propose une expérience d'écriture intuitive. Son interface minimaliste privilégie le contenu sur la mise en page, tout en offrant l'essentiel : import de médias, mode hors-ligne et raccourcis clavier pour plus d'efficacité.",
@@ -687,6 +693,7 @@
687693
"Reset": "Réinitialiser",
688694
"Restore": "Restaurer",
689695
"Search": "Rechercher",
696+
"Search docs": "Rechercher un document",
690697
"Search modal": "Modale de partage",
691698
"Search user result": "Résultat de la recherche utilisateur",
692699
"Select a document": "Sélectionnez un document",
@@ -1024,6 +1031,7 @@
10241031
"Rephrase": "Herschrijf",
10251032
"Restore": "Herstel",
10261033
"Search": "Zoeken",
1034+
"Search docs": "Documenten zoeken",
10271035
"Search modal": "Zoek modal",
10281036
"Search user result": "Zoek resultaat",
10291037
"Select a document": "Selecteer een document",

0 commit comments

Comments
 (0)