handleTriggerClick fires twice when triggerTagName set to "button" and space bar is used
erinrep opened this issue · comments
Erin Replogle commented
Describe the bug
When using the component while triggerTagName
is set to "button", hitting the space bar while the button is in focus results in unexpected behavior. The space bar will fire the onClick
event for a button, but since the onKeyPress
event is also looking for the space bar, handleTriggerClick
gets called twice.
To Reproduce
Steps to reproduce the behavior:
- Tab to the trigger button
- Press the space bar
- The collapsible will open
- Press the space bar again
- The collapsible will not close
Expected behavior
Pressing the space bar while the button is in focus will open and close the collapsible as expected