Skip to content
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

[Canvas] Refactor keyboard shortcut handlers #42628

Closed
3 tasks
cqliu1 opened this issue Aug 5, 2019 · 2 comments
Closed
3 tasks

[Canvas] Refactor keyboard shortcut handlers #42628

cqliu1 opened this issue Aug 5, 2019 · 2 comments
Labels
chore Feature:Canvas impact:medium Addressing this issue will have a medium level of impact on the quality/strength of our product. loe:medium Medium Level of Effort Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas

Comments

@cqliu1
Copy link
Contributor

cqliu1 commented Aug 5, 2019

We've run into a few issues where shortcuts have been disabled accidentally and other issues surrounding the keyboard shortcut handlers where key events have been swallowed.

We currently use the Shortcut component from the react-shortcuts package to handle shortcuts. Some of these are rendered conditionally based on the current app state. There are multiple instances of the Shortcut components across the app that should handle different types of shortcuts, i.e. element shortcuts vs expression editor shortcuts, but I've noticed there's some overlap in some of the handlers where the same shortcuts are being handled different in two places.

We should audit the handlers and potentially reorganize the namespaces for the keymap and introduce global apps. We also need to double check that the correct props are being passed into each component per concern so the handlers don't clash and fire when they're not support to.

I think it'd also be beneficial to refactor the handlers and place them in a centralized location where we can see all of the shortcuts at once. This should help with making sure changes are applied to the shortcuts consistently, so we don't accidentally miss one of the shortcuts handlers.

TODOs:

  • reorganize shortcuts and introduce a GLOBAL namespace for shortcuts that should always be available regardless of the current app state, like refresh or toggle fullscreen mode
  • move all <Shortcut /> instances into a single component (is this actually something we want to do?)
  • audit props to make sure the handlers are behaving correctly and now swallowing up other key event handlers

Shortcut handler locations:

Shortcut Availability

  Read only mode Fullscreen Edit mode without selection Element(s) selected Expression editor Notes
Element controls            
Cut ⌘ X N N N Y Y  
Copy ⌘ C N N N Y Y  
Paste ⌘ V N N Y Y Y  
Clone ⌘ D N N N Y Y  
Delete DEL or BACKSPACE N N N Y Y  
Bring to front ⌘ ↑ N N N Y Y  
Bring forward ⌘ SHIFT ↑ N N N Y Y  
Send backward ⌘ ↓ N N N Y Y  
Send to back ⌘ SHIFT ↓ N N N Y Y  
Group G N N N Y Y  
Ungroup U N N N Y Y  
Shift up by 10px ↑ N N N Y Y  
Shift down by 10px ↓ N N N Y Y  
Shift left by 10px ← N N N Y Y  
Shift right by 10px → N N N Y Y  
Shift up by 1px SHIFT ↑ N N N Y Y  
Shift down by 1px SHIFT ↓ N N N Y Y  
Shift left by 1px SHIFT ← N N N Y Y  
Shift right by 1px SHIFT → N N N Y Y  
Expression controls            
Run whole expression ⌘ ENTER N N N N Y  
Editor controls            
Resize from center ⌥ DRAG N N N Y Y Only for documentation. Handled by the layout engine, not react-shortcuts. Move this to element controls?
Move, resize, and rotate without snapping ⌘ DRAG N N N Y Y Only for documentation. Handled by the layout engine, not react-shortcuts. Move this to element controls?
Select multiple elements SHIFT CLICK N N Y Y Y Only for documentation. Handled by the layout engine, not react-shortcuts
Select element below ⌘ CLICK N N Y Y Y Only for documentation. Handled by the layout engine, not react-shortcuts
Undo last action ⌘ Z N N Y Y Y Do we want to be able to undo/redo in fullscreen mode? I'm leaning towards no
Redo last action ⌘ SHIFT Z N N Y Y Y  
Show grid ⌥ G N N Y Y Y  
Toggle edit mode ⌥ E Y N Y Y Y Do we want to be able to change toggle edit/read mode while in fullscreen mode? I'm also leaning towards no here
Zoom in ⌘ ⌥ + Y N Y Y Y  
Zoom out ⌘ ⌥ - Y N Y Y Y  
Reset zoom to 100% ⌘ ⌥ [ Y N Y Y Y  
Go to previous page ⌥ [ Y Y Y Y Y Note: different shortcuts are available in edit vs fullscreen
Go to next page ⌥ ] Y Y Y Y Y Note: different shortcuts are available in edit vs fullscreen
Refresh workpad ⌥ R Y Y Y Y Y  
Presentation controls            
Enter presentation mode ⌥ F or ⌥ P Y Y Y Y Y We may need to add this to the editor namespace
Exit presentation mode ESC N Y N N N This could be global, it's just only useful when you're already in fullscreen mode
Go to previous page ⌥ [ or BACKSPACE or ← Y Y Y Y Y Note: different shortcuts are available in edit vs fullscreen
Go to next page ⌥ ] or SPACE or → Y Y Y Y Y Note: different shortcuts are available in edit vs fullscreen
Refresh workpad ⌥ R Y Y Y Y Y  
Toggle page cycling P Y Y Y Y Y  
@cqliu1 cqliu1 added chore Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas loe:needs-research This issue requires some research before it can be worked on or estimated labels Aug 5, 2019
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-canvas

@cqliu1 cqliu1 added loe:medium Medium Level of Effort impact:medium Addressing this issue will have a medium level of impact on the quality/strength of our product. and removed loe:needs-research This issue requires some research before it can be worked on or estimated labels Aug 5, 2019
@ThomThomson
Copy link
Contributor

Closing this for the time being as we are currently unable to prioritize canvas UX issues. We can reopen this if our priorities change.

@ThomThomson ThomThomson closed this as not planned Won't fix, can't repro, duplicate, stale Apr 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore Feature:Canvas impact:medium Addressing this issue will have a medium level of impact on the quality/strength of our product. loe:medium Medium Level of Effort Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas
Projects
None yet
Development

No branches or pull requests

4 participants