Key press event listeners should work with `ActionList`
Describe the bug Key press event listeners for interacting with action list are not invoked when an element is in focus. This issue was first posted in the primer-react channel (link), opening an issue here for better tracking and visibility.
To Reproduce
Steps to reproduce the behavior with the current ActionList component:
- Check out onto commit ff7e364 in the memex repo and run
npm start - Click on the '+' icon in the omnibar at the bottom of the page
- Select 'Add item from repository' to open the side panel
- Try navigating the list with arrow keys as well as
j/k - Tab once
- Press
j/k/arrow up/arrow downwill have no effect - Click somewhere to blur the focused element
- Press
j/k/arrow up/arrow downnavigates the list
Steps to reproduce the behavior with the new ActionList component:
- Check out onto commit e7e437b6d8 in the memex repo
- Run
npm install @primer/react@[local-version](the most recent local version as of now is0.0.0-202252993854) and thennpm start - Click on the '+' icon in the omnibar at the bottom of the page
- Select 'Add item from repository' to open the side panel
- Press
jto start navigating the list (the indexing is not completely correct because we only added the single-key shortcuts here for making debugging this issue easier) - Press
j/kagain will have no effect - Click outside the list to blur the focused list item
- Press
jagain navigates to the next item in the list
Expected behavior
Key press event listeners inside an ActionList should be invoked even if an element is in focus.
Desktop (please complete the following information):
- OS: macOS Monterey 12.4
- Browser: Chrome (103.0.5060.53), Safari(15.5), Firefox (102.0.1)
Additional context
Other keyboard shortcuts that are affected are x for selecting/unselecting the checkbox and cmd+Enter for submitting.
Following the recent updates on PR https://github.com/primer/react/pull/2152, we decided to revert our work (https://github.com/github/memex/pull/10707) to make use of the current ActionList component without adding any custom keyboard shortcuts, and therefore only commits are provided for debugging. However we thought opening an issue for this event listener problem might be helpful for future work.
cc @siddharthkp
Hi! This issue has been marked as stale because it has been open with no activity for 180 days. You can comment on the issue or remove the stale label to keep it open. If you do nothing, this issue will be closed in 7 days.
Not stale
Hi! This issue has been marked as stale because it has been open with no activity for 180 days. You can comment on the issue or remove the stale label to keep it open. If you do nothing, this issue will be closed in 7 days.
not stale
Hi! This issue has been marked as stale because it has been open with no activity for 180 days. You can comment on the issue or remove the stale label to keep it open. If you do nothing, this issue will be closed in 7 days.
not stale :)
Hi! This issue has been marked as stale because it has been open with no activity for 180 days. You can comment on the issue or remove the stale label to keep it open. If you do nothing, this issue will be closed in 7 days.