(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
- ♿ hide decorative icons from assistive tech with aria-hidden #1404
- ♿ 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
### Fixed

View File

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

View File

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

View File

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