♿️(frontend) enhance sidepanel accessibility
Use the appropriate HTML <aside> element for the side panel and enhance it with the correct ARIA attributes to improve accessibility.
This commit is contained in:
committed by
aleb_the_flash
parent
3ddb075c6b
commit
3cd5c77f42
@@ -16,6 +16,7 @@ import { Info } from './Info'
|
|||||||
|
|
||||||
type StyledSidePanelProps = {
|
type StyledSidePanelProps = {
|
||||||
title: string
|
title: string
|
||||||
|
ariaLabel: string
|
||||||
children: ReactNode
|
children: ReactNode
|
||||||
onClose: () => void
|
onClose: () => void
|
||||||
isClosed: boolean
|
isClosed: boolean
|
||||||
@@ -26,6 +27,7 @@ type StyledSidePanelProps = {
|
|||||||
|
|
||||||
const StyledSidePanel = ({
|
const StyledSidePanel = ({
|
||||||
title,
|
title,
|
||||||
|
ariaLabel,
|
||||||
children,
|
children,
|
||||||
onClose,
|
onClose,
|
||||||
isClosed,
|
isClosed,
|
||||||
@@ -33,7 +35,7 @@ const StyledSidePanel = ({
|
|||||||
isSubmenu = false,
|
isSubmenu = false,
|
||||||
onBack,
|
onBack,
|
||||||
}: StyledSidePanelProps) => (
|
}: StyledSidePanelProps) => (
|
||||||
<div
|
<aside
|
||||||
className={css({
|
className={css({
|
||||||
borderWidth: '1px',
|
borderWidth: '1px',
|
||||||
borderStyle: 'solid',
|
borderStyle: 'solid',
|
||||||
@@ -58,6 +60,8 @@ const StyledSidePanel = ({
|
|||||||
style={{
|
style={{
|
||||||
transform: isClosed ? 'translateX(calc(360px + 1.5rem))' : 'none',
|
transform: isClosed ? 'translateX(calc(360px + 1.5rem))' : 'none',
|
||||||
}}
|
}}
|
||||||
|
aria-hidden={isClosed}
|
||||||
|
aria-label={ariaLabel}
|
||||||
>
|
>
|
||||||
<Heading
|
<Heading
|
||||||
slot="title"
|
slot="title"
|
||||||
@@ -74,7 +78,7 @@ const StyledSidePanel = ({
|
|||||||
{isSubmenu && (
|
{isSubmenu && (
|
||||||
<Button
|
<Button
|
||||||
variant="secondaryText"
|
variant="secondaryText"
|
||||||
size={'sm'}
|
size="sm"
|
||||||
square
|
square
|
||||||
className={css({ marginRight: '0.5rem' })}
|
className={css({ marginRight: '0.5rem' })}
|
||||||
onPress={onBack}
|
onPress={onBack}
|
||||||
@@ -104,7 +108,7 @@ const StyledSidePanel = ({
|
|||||||
</Button>
|
</Button>
|
||||||
</Div>
|
</Div>
|
||||||
{children}
|
{children}
|
||||||
</div>
|
</aside>
|
||||||
)
|
)
|
||||||
|
|
||||||
type PanelProps = {
|
type PanelProps = {
|
||||||
@@ -144,6 +148,7 @@ export const SidePanel = () => {
|
|||||||
return (
|
return (
|
||||||
<StyledSidePanel
|
<StyledSidePanel
|
||||||
title={t(`heading.${activeSubPanelId || activePanelId}`)}
|
title={t(`heading.${activeSubPanelId || activePanelId}`)}
|
||||||
|
ariaLabel={t('ariaLabel')}
|
||||||
onClose={() => {
|
onClose={() => {
|
||||||
layoutStore.activePanelId = null
|
layoutStore.activePanelId = null
|
||||||
layoutStore.activeSubPanelId = null
|
layoutStore.activeSubPanelId = null
|
||||||
|
|||||||
@@ -270,6 +270,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"sidePanel": {
|
"sidePanel": {
|
||||||
|
"ariaLabel": "Seitenleiste",
|
||||||
"heading": {
|
"heading": {
|
||||||
"participants": "Teilnehmer",
|
"participants": "Teilnehmer",
|
||||||
"effects": "Effekte",
|
"effects": "Effekte",
|
||||||
|
|||||||
@@ -270,6 +270,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"sidePanel": {
|
"sidePanel": {
|
||||||
|
"ariaLabel": "Sidepanel",
|
||||||
"heading": {
|
"heading": {
|
||||||
"participants": "Participants",
|
"participants": "Participants",
|
||||||
"effects": "Backgrounds and Effects",
|
"effects": "Backgrounds and Effects",
|
||||||
|
|||||||
@@ -270,6 +270,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"sidePanel": {
|
"sidePanel": {
|
||||||
|
"ariaLabel": "Panneau latéral",
|
||||||
"heading": {
|
"heading": {
|
||||||
"participants": "Participants",
|
"participants": "Participants",
|
||||||
"effects": "Arrière-plans et effets",
|
"effects": "Arrière-plans et effets",
|
||||||
|
|||||||
@@ -270,6 +270,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"sidePanel": {
|
"sidePanel": {
|
||||||
|
"ariaLabel": "Zijbalk",
|
||||||
"heading": {
|
"heading": {
|
||||||
"participants": "Deelnemers",
|
"participants": "Deelnemers",
|
||||||
"effects": "Effecten",
|
"effects": "Effecten",
|
||||||
|
|||||||
Reference in New Issue
Block a user