🔼 a11y: Proper attributes for the side panel toggle button (#4559)

- added aria-expanded attribute to indicate the panel's expanded/collapsed state
- added aria-controls attribute to specify the element controlled by the button
- updated aria-label using the localize function for better description
This commit is contained in:
J'aimemin 2024-10-29 00:03:38 +09:00 committed by GitHub
parent b939e24f67
commit 262176fec4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -34,7 +34,9 @@ export default function NavToggle({
>
<TooltipAnchor
side={side === 'right' ? 'left' : 'right'}
aria-label={`toggle-${side === 'left' ? 'chat-history' : 'controls'}-nav`}
aria-label={side === 'left' ? localize('com_ui_chat_history') : localize('com_ui_controls')}
aria-expanded={navVisible}
aria-controls={side === 'left' ? 'chat-history-nav' : 'controls-nav'}
id={`toggle-${side}-nav`}
onClick={onToggle}
role="button"