bootstrap icon indicating copy to clipboard operation
bootstrap copied to clipboard

Add Keyboard Navigation for Bootstrap Accordion

Open MohamadSalman11 opened this issue 10 months ago • 1 comments

Prerequisites

Proposal

It would be great if Bootstrap's accordion component supported keyboard navigation, allowing users to navigate between sections using the arrow keys (up/down), just like the dropdown component. If this sounds good, I can try it out.

CodePen example that I found: Accordion with keyboard navigation Of course, the implementation can vary; this is just a demonstration of the idea.

Documentation: components/accordion

Motivation and context

This would make the accordion more accessible and improve user experience, especially for keyboard-only users

MohamadSalman11 avatar Jan 28 '25 12:01 MohamadSalman11

Referring to the ARIA Authoring Practices Guide (APG) - Accordion Pattern - Keyboard Interaction, it seems that the Down, Up, Home, and End keys are optional.

At one point, we considered using <details><summary> elements for accordions (either as a replacement or a variant), but these elements don't appear to support those keys (see MDN's note on multiple named disclosure boxes).

I don't have a strong opinion on this feature at the moment, but it might be worth checking how other libraries and design systems handle it. @patrickhlauke, do you have any thoughts on whether we should pursue this?

julien-deramond avatar Jan 29 '25 18:01 julien-deramond

tab and enter works for these, as it does for the rest of the collapse examples as far as I know. I don't think we should do keyboard arrows unless there's an overwhelming push for that.

mdo avatar Apr 10 '25 22:04 mdo