(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>
This commit is contained in:
Cyril
2025-09-24 09:55:41 +02:00
parent f337a2a8f2
commit 8ab21ef00d
4 changed files with 10 additions and 4 deletions

View File

@@ -18,6 +18,7 @@ and this project adheres to
- ♿ add pdf outline property to enable bookmarks display #1368 - ♿ add pdf outline property to enable bookmarks display #1368
- ♿ hide decorative icons from assistive tech with aria-hidden #1404 - ♿ hide decorative icons from assistive tech with aria-hidden #1404
- ♿ remove redundant aria-label to avoid over-accessibility #1420 - ♿ remove redundant aria-label to avoid over-accessibility #1420
- ♿ improve semantic structure and aria roles of leftpanel #1431
- ♿ add default background to left panel for better accessibility #1423 - ♿ add default background to left panel for better accessibility #1423
### Fixed ### Fixed

View File

@@ -49,8 +49,6 @@ export const LeftPanelTargetFilters = () => {
return ( return (
<Box <Box
as="nav"
aria-label={t('Document sections')}
$justify="center" $justify="center"
$padding={{ horizontal: 'sm' }} $padding={{ horizontal: 'sm' }}
$gap={spacingsTokens['2xs']} $gap={spacingsTokens['2xs']}

View File

@@ -1,5 +1,6 @@
import { usePathname } from 'next/navigation'; import { usePathname } from 'next/navigation';
import { useEffect } from 'react'; import { useEffect } from 'react';
import { useTranslation } from 'react-i18next';
import { createGlobalStyle, css } from 'styled-components'; import { createGlobalStyle, css } from 'styled-components';
import { Box, SeparatedSection } from '@/components'; import { Box, SeparatedSection } from '@/components';
@@ -22,6 +23,7 @@ const MobileLeftPanelStyle = createGlobalStyle`
export const LeftPanel = () => { export const LeftPanel = () => {
const { isDesktop } = useResponsiveStore(); const { isDesktop } = useResponsiveStore();
const { t } = useTranslation();
const { colorsTokens, spacingsTokens } = useCunninghamTheme(); const { colorsTokens, spacingsTokens } = useCunninghamTheme();
const { togglePanel, isPanelOpen } = useLeftPanelStore(); const { togglePanel, isPanelOpen } = useLeftPanelStore();
@@ -46,6 +48,8 @@ export const LeftPanel = () => {
background-color: ${colorsTokens['greyscale-000']}; background-color: ${colorsTokens['greyscale-000']};
`} `}
className="--docs--left-panel-desktop" className="--docs--left-panel-desktop"
as="nav"
aria-label={t('Document sections')}
> >
<Box <Box
$css={css` $css={css`
@@ -78,6 +82,8 @@ export const LeftPanel = () => {
> >
<Box <Box
data-testid="left-panel-mobile" data-testid="left-panel-mobile"
as="nav"
aria-label={t('Document sections')}
$css={css` $css={css`
width: 100%; width: 100%;
justify-content: center; justify-content: center;

View File

@@ -24,8 +24,8 @@ export const LeftPanelFavorites = () => {
return ( return (
<Box <Box
as="nav" as="section"
aria-label={t('Pinned documents')} aria-labelledby="pinned-docs-title"
className="--docs--left-panel-favorites" className="--docs--left-panel-favorites"
> >
<HorizontalSeparator $withPadding={false} /> <HorizontalSeparator $withPadding={false} />
@@ -41,6 +41,7 @@ export const LeftPanelFavorites = () => {
$variation="700" $variation="700"
$padding={{ horizontal: '3xs' }} $padding={{ horizontal: '3xs' }}
$weight="700" $weight="700"
id="pinned-docs-title"
> >
{t('Pinned documents')} {t('Pinned documents')}
</Text> </Text>