I have a few input elements inside a Bootstrap panel-heading
. I've got click handlers on these which works fine using a mouse, but I need them to be keyboard operable for WCAG compliance. Is there an easy way to have them respond to click OR spacebar/enter press? The only way I can see are either:
- Changing the tags to buttons and removing the button styling with CSS
- Adding a keydown trigger to the document and checking
e.keyCode
Both of which seem long winded and kind if hackey.
EDIT: To be specific. In the header, I have the following structure:
------------------------------------------
- \/ Section Name [15] [On/Off]
------------------------------------------
Wrapping the elements in individual <a>
tags allows them to receive focus, but only actually clicking the section name will trigger the expand handler.