Skip to content

Commit f382533

Browse files
committed
✨(frontend) improve semantic structure and aria roles of leftpanel
use nav and appropriate aria attributes to enhance accessibility Signed-off-by: Cyril <c.gromoff@gmail.com>
1 parent 3607faa commit f382533

File tree

4 files changed

+10
-4
lines changed

4 files changed

+10
-4
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ and this project adheres to
1818
- ♿ add pdf outline property to enable bookmarks display #1368
1919
- ♿ hide decorative icons from assistive tech with aria-hidden #1404
2020
- ♿ remove redundant aria-label to avoid over-accessibility #1420
21+
- ♿ improve semantic structure and aria roles of leftpanel #1431
2122

2223
### Fixed
2324

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,6 @@ export const LeftPanelTargetFilters = () => {
4949

5050
return (
5151
<Box
52-
as="nav"
53-
aria-label={t('Document sections')}
5452
$justify="center"
5553
$padding={{ horizontal: 'sm' }}
5654
$gap={spacingsTokens['2xs']}

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { usePathname } from 'next/navigation';
22
import { useEffect } from 'react';
3+
import { useTranslation } from 'react-i18next';
34
import { createGlobalStyle, css } from 'styled-components';
45

56
import { Box, SeparatedSection } from '@/components';
@@ -22,6 +23,7 @@ const MobileLeftPanelStyle = createGlobalStyle`
2223

2324
export const LeftPanel = () => {
2425
const { isDesktop } = useResponsiveStore();
26+
const { t } = useTranslation();
2527

2628
const { colorsTokens, spacingsTokens } = useCunninghamTheme();
2729
const { togglePanel, isPanelOpen } = useLeftPanelStore();
@@ -45,6 +47,8 @@ export const LeftPanel = () => {
4547
border-right: 1px solid ${colorsTokens['greyscale-200']};
4648
`}
4749
className="--docs--left-panel-desktop"
50+
as="nav"
51+
aria-label={t('Document sections')}
4852
>
4953
<Box
5054
$css={css`
@@ -77,6 +81,8 @@ export const LeftPanel = () => {
7781
>
7882
<Box
7983
data-testid="left-panel-mobile"
84+
as="nav"
85+
aria-label={t('Document sections')}
8086
$css={css`
8187
width: 100%;
8288
justify-content: center;

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ export const LeftPanelFavorites = () => {
2424

2525
return (
2626
<Box
27-
as="nav"
28-
aria-label={t('Pinned documents')}
27+
as="section"
28+
aria-labelledby="pinned-docs-title"
2929
className="--docs--left-panel-favorites"
3030
>
3131
<HorizontalSeparator $withPadding={false} />
@@ -41,6 +41,7 @@ export const LeftPanelFavorites = () => {
4141
$variation="700"
4242
$padding={{ horizontal: '3xs' }}
4343
$weight="700"
44+
id="pinned-docs-title"
4445
>
4546
{t('Pinned documents')}
4647
</Text>

0 commit comments

Comments
 (0)