(frontend) fix toggle panel button a11y with dynamic label

improves screen sr by updating label and state indication dynamically

Signed-off-by: Cyril <c.gromoff@gmail.com>
This commit is contained in:
Cyril
2025-11-19 11:29:34 +01:00
parent 9b03754f88
commit acdde81a3d
5 changed files with 42 additions and 25 deletions

View File

@@ -12,12 +12,16 @@ export const ButtonTogglePanel = () => {
<Button
size="medium"
onClick={() => togglePanel()}
aria-label={t('Open the header menu')}
aria-label={t(
isPanelOpen ? 'Close the header menu' : 'Open the header menu',
)}
aria-expanded={isPanelOpen}
variant="tertiary"
icon={
<Icon $withThemeInherited iconName={isPanelOpen ? 'close' : 'menu'} />
}
className="--docs--button-toggle-panel"
data-testid="header-menu-toggle"
/>
);
};