-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add initial keyboard shortcuts #32
Conversation
this is specifically for vim-like "gi", "go" or individual key "j" and "k" handling. Chord combinations should probably have a different hook without the timeout parameter
|
hmm doesn't seem to work for me when i pull it down. i only have one row in my table fwiw. it gets auto selected, but pressing enter does nothing. then if i press The code that causes the crash is in // `row` is not defined when i press enter, which causes this to crash
handleRowClick={(row) => navigate(`/requests/${row.id}`)} |
also when i navigate with |
yea ran into this myself with 1 row. Think the hook + its use needs some rework.. brb |
should be fixed (except the history issue) @brettimus can you give it a try? |
yep seems fixed! i think i resolved the history issue, kinda hard to explain, but the gist of it is that you should avoid side-effects in a state-updater function. react got confused. i moved the problematic logic outside of the state-updater, and put it inside its own |
if you mouse over a row and then start using "j" and "k" to move around it will continue from the point of where you moused
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some stylistic feedback.
related to FP-3765
Initial PR for experimenting with keyboard shortcuts in the mizu-fpx app.
It adds a generic
useKeySequence
hook that can be used to add keyboard shortcuts to any React component.It also adds a basic navigation hook for up/down the request table, and enter/escape for jumping to the details and back home.
TODO:
[ ] I didn't add any scope yet so the keyboard shortcuts are global to the component. Probably worth figuring out some sort of scope system.