You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am working within a Notebook style application attempting to add Keyboard shortcuts. I am using react-hotkeys to do so. I've run into an issue. If I wrap the component (ConectedCell.tsx) that holds all the actions and properties that I wish to trigger with the HotKeys and pass it both the handlers and the keymap, then everything works as expected as hotkeys works by triggering shortcuts when the HotKeys components child is in focus. However doing this the hotkeys only work when a cell is in focus, and I would like them to work at the notebook level, so any where in the application I have focus will be able to call the actions at the cell level. So I have wrapped a parent component (NotebookShell) of the ConnectedCell so that when the notebook is in focus it will still trigger the hotkeys. I have passed in the keymap from a helper file into the NotebookShell, and I have passed in the handlers to ConnectedCell.tsx Area . The keymap is working fine, however they do not seem to be getting the handlers.
Note: Even with the setup below, the hotkeys will fire when a cell is specifically focused, however when I focus the notebook they do not. I have the logs at the bottom, and you can see when I click the cell in the options you will see the handlers, however when I click the Notebook, you will not see the handlers in the log, they will be empty.
According to the react-hotkeys documentation, the setup I have should work.
I am working within a Notebook style application attempting to add Keyboard shortcuts. I am using react-hotkeys to do so. I've run into an issue. If I wrap the component (ConectedCell.tsx) that holds all the actions and properties that I wish to trigger with the HotKeys and pass it both the handlers and the keymap, then everything works as expected as hotkeys works by triggering shortcuts when the HotKeys components child is in focus. However doing this the hotkeys only work when a cell is in focus, and I would like them to work at the notebook level, so any where in the application I have focus will be able to call the actions at the cell level. So I have wrapped a parent component (NotebookShell) of the ConnectedCell so that when the notebook is in focus it will still trigger the hotkeys. I have passed in the keymap from a helper file into the NotebookShell, and I have passed in the handlers to ConnectedCell.tsx Area . The keymap is working fine, however they do not seem to be getting the handlers.
Note: Even with the setup below, the hotkeys will fire when a cell is specifically focused, however when I focus the notebook they do not. I have the logs at the bottom, and you can see when I click the cell in the options you will see the handlers, however when I click the Notebook, you will not see the handlers in the log, they will be empty.
According to the react-hotkeys documentation, the setup I have should work.
KeyMap
--
Handlers
--
--
NotebookShell, Parent of ConnectedCell, 3rd Parent of Connected Cell
--
Log when cell is focused
--
Log when notebook is focused
Version : v2.0.0
The text was updated successfully, but these errors were encountered: