BeBuilder Toggle element: add Enter and Space keyboard support
Could you please consider adding add keyboard activation to the BeBuilder Toggle element? The toggle heading can receive keyboard focus, but pressing Enter or Space does not open or close the panel. Clicking it with a mouse works as expected.
Steps to reproduce
- Add a Toggle element to a page and open the published page.
- Press Tab until a toggle heading receives focus.
- Press Enter or Space. The panel does not open or close.
Requested behaviour
Enter and Space should open or close the focused panel, with focus staying on its heading. Pressing Space should activate the toggle without scrolling the page. Please also put aria-expanded on the interactive control and update it to reflect whether the panel is open or closed.
A native button for each toggle heading would provide the expected keyboard behaviour. If the existing markup needs to stay, an Enter and Space listener would give users equivalent control.
This would make Toggle content accessible to people who navigate by keyboard or use assistive technologies. It would also let screen readers announce the current state of each panel.
Comments
Hi,
Thanks for the suggestion. I have passed it on to the dev team.
Best regards