Skip to content
This repository has been archived by the owner on Aug 1, 2022. It is now read-only.

feat(ui): add keyboard shortcuts #759

Merged
merged 9 commits into from Aug 7, 2020
Merged

feat(ui): add keyboard shortcuts #759

merged 9 commits into from Aug 7, 2020

Conversation

juliendonck
Copy link
Member

Adds keyboard shortcuts:
// To open help => OS modifier key + /
// To open settings => OS modifier key + ,
// To open search => OS modifier key + p
// To open design system => OS modifier key + d
// To create a new project => OS modifier key + n

Also uses cmd key on mac and ctrl on other OS's for all shortcuts.

closes #756

@juliendonck juliendonck self-assigned this Aug 6, 2020
@juliendonck juliendonck added this to the Housekeeping milestone Aug 6, 2020
@juliendonck
Copy link
Member Author

@xla can you test if this works on linux? Should work with the ctrl-key.

ui/Hotkeys.svelte Outdated Show resolved Hide resolved
ui/Screen/Help.svelte Outdated Show resolved Hide resolved
@rudolfs
Copy link
Member

rudolfs commented Aug 6, 2020

I wonder if there's a nice way to signal the user that keyboard shortcuts are available in the app?

Copy link
Member

@rudolfs rudolfs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dope 🚀

@juliendonck
Copy link
Member Author

I wonder if there's a nice way to signal the user that keyboard shortcuts are available in the app?

@rudolfs I was wondering about that as well. Maybe we can put it in the settings in some way. @brandonhaslegs what do you think?

@brandonhaslegs
Copy link
Contributor

brandonhaslegs commented Aug 6, 2020

Normally they're in tooltips.
Slack:
image

Figma:
image

Notion:
image

Google Hangouts
image

@rudolfs
Copy link
Member

rudolfs commented Aug 6, 2020

Hm, maybe we can stick them in the tooltips and get rid of the help screen?

@juliendonck
Copy link
Member Author

Normally they're in tooltips.
Slack:
image

Figma:
image

@rudolfs @brandonhaslegs what would be the icon for ctrl?

ui/Screen/Help.svelte Outdated Show resolved Hide resolved
@rudolfs
Copy link
Member

rudolfs commented Aug 6, 2020

@rudolfs @brandonhaslegs what would be the icon for ctrl?

I don't think it has an icon, it should be just "Ctrl": https://en.wikipedia.org/wiki/Control_key.
Or maybe ^?

@juliendonck
Copy link
Member Author

@rudolfs @brandonhaslegs what would be the icon for ctrl?

I don't think it has an icon, it should be just "Ctrl": https://en.wikipedia.org/wiki/Control_key.
Or maybe ^?

@rudolfs yeah but I think that's a mac thing. Not sure windows people get it...

@rudolfs
Copy link
Member

rudolfs commented Aug 6, 2020

@rudolfs yeah but I think that's a mac thing. Not sure windows people get it...

I think Ctrl is the safest option then.

@xla
Copy link
Contributor

xla commented Aug 6, 2020

Shouldn't it show the key depending on the OS, i.e. Cmd for mac and Ctrl for other platforms?

@juliendonck
Copy link
Member Author

juliendonck commented Aug 6, 2020

Shouldn't it show the key depending on the OS, i.e. Cmd for mac and Ctrl for other platforms?

@xla jup that's what I've implemented. @rudolfs and I are just talking about how to display ctrl in the app.

Copy link
Contributor

@xla xla left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great to see that we can easily extend the existing key handling code. Some comments inline.

@juliendonck The shortcuts with ctrl worked on my linux machine. The only oddity is when open the help with the keyboard all elements and text are selected.

ui/Hotkeys.svelte Show resolved Hide resolved
ui/Hotkeys.svelte Outdated Show resolved Hide resolved
ui/Hotkeys.svelte Outdated Show resolved Hide resolved
ui/Screen/Help.svelte Outdated Show resolved Hide resolved
ui/Screen/Help.svelte Outdated Show resolved Hide resolved
@juliendonck
Copy link
Member Author

@xla @rudolfs @brandonhaslegs decided to keep it simple for now and create a link in the settings to our keyboard shortcuts. It didn't make sense to put them in the tooltips for now since there are only 2 places where you'd do it (settings and new project) and it didn't make sense to put a tooltip on the new project button every time you hovered it. Should do for now.

Screenshot 2020-08-07 at 12 38 57

@juliendonck juliendonck requested review from xla and rudolfs August 7, 2020 10:40
ui/src/settings.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@xla xla left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💟 🐔 👰 ☣

Copy link
Contributor

@brandonhaslegs brandonhaslegs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Triggering a new keyboard shortcut that opens a modal should close any previous modals right? With these shortcuts I can myself get into a situation where I have many modals open on top of each other and closing reveals all the previous ones I had open. For example, try making a new project, then opening the keyboard shortcuts modal, then new project, then shortcuts modal, etc, etc… it opens endless modals on top of one another. Maybe this can be reported in another issue though.

Excited to have keyboard shortcuts!

Co-authored-by: Rūdolfs Ošiņš <rudolfs@osins.org>
@juliendonck
Copy link
Member Author

Triggering a new keyboard shortcut that opens a modal should close any previous modals right? With these shortcuts I can myself get into a situation where I have many modals open on top of each other and closing reveals all the previous ones I had open. For example, try making a new project, then opening the keyboard shortcuts modal, then new project, then shortcuts modal, etc, etc… it opens endless modals on top of one another. Maybe this can be reported in another issue though.

Excited to have keyboard shortcuts!

@brandonhaslegs our modal world is a separate concern that we won't be focusing on for now. It's a long story...

@juliendonck juliendonck merged commit 1485bba into master Aug 7, 2020
@juliendonck juliendonck added this to Done in β1 Release Preparation via automation Aug 7, 2020
@juliendonck juliendonck deleted the julien/shortcuts branch August 7, 2020 14:31
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

Add keyboard shortcuts
5 participants