-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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 new keyboard shortcuts help modal #8316
Conversation
Hey @jasmussen - before I take this one any further I thought I'd seek some design / copy feedback. This has the same issue as the other PR with the formatting of shortcuts (e.g. ⌘+? instead of ⌘?), so I'll work on that now and cherry-pick the change onto both branches. (edit: updated screenshot with improvements) Not sure if this is too wordy, or perhaps it should just be stripped back to something simpler. Any other design hints would be good. I know heading sizes are not quite right, should the modal have a bigger header? |
Very very cool work, thank you for working on this. I can't get the modal to show. Finally, can we add it as a menu item? Like this: I think this will be very welcome. Just looking at the screenshot, I think this is a great start. I like how Google Inbox shows their shortcuts: Note the little gray background behind each shortcut button. We can probably use the kbd element for this: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/kbd — possibly with a little minimalist styling. Notably I like the relaxed row-like layout of keyboard shortcuts in Chrome OS: Flagging also @karmatosed for thoughts. |
(On the copy front, I'm not sure that you need the first sentence/subhead in each section; they bulk the modal up, but don't add any info that's not already there in the title and instructions. It also seems like the slash inserter could be part of the block shortcuts section, and I wonder if selection shortcuts can be part of global; then you have a simpler structure: general, block-specific, text-specific.) |
I would many +1's the way Google show this as being a good pattern for us to follow. Thanks for all your work on this @talldan. |
ef530a9
to
8bfcd16
Compare
@jasmussen I've made some changes today based on the feedback. Here's how it looks now:
Looks like the editor needed focus for shortcut to work, I've fixed that now and it should work regardless.
The drawback with Shift+? is that it can't be used while typing, whereas Cmd+? can be. I'm happy to change it but thought I'd at least make you aware of why I went for Cmd+?.
I still need to work on this. Will pick that up next. |
Fair point. @karmatosed any thoughts? Go for Google consistency or go for the meta key? Might meta+? conflict with other things? Looking forward to the menu item! Modal looks great. Awesome work. A few small things:
Something like that, but perhaps with @michelleweber help.
On the ticket it was noted that ⌘+ duplicates for zoom, and ⌘D duplicates for bookmark. What other combos can we use here? ⌘+Shift+ + ? ⌘+Shift+D? |
@talldan Design is looking good! I'm not a designer, but have two small points of feedback:
Slack adds little grey lines to help easily align shortcut to description |
I think I've addressed a lot of the feedback
@jasmussen - I haven't been able to find any issues with using Cmd+?, but I haven't checked Ctrl+? on Windows or Linux. I'll start looking at the best way to set up my windows box tomorrow. |
ba70cfd
to
fe8a15c
Compare
Just spotted, I should also add the shortcut to the close modal button :) |
Love it. This is really coming together. Thanks for adding the menu item, modal works great. I still can't get ⌘+? to work on my danish keyboard. Question mark is the shift option of the plus button, so if I press ⌘? I zoom in. If I press ⌘+Shift+? I open Chrome help. I think we either need to find a different shortcut — perhaps one localized to each keyboard, or one that leverages a key that's in the same place in all locales. Or, just be fine with NOT having a keyboard shortcut for help. Does TinyMCE have a keyboard shortcut for help, that we can use? Also I think it's worth adding that if you are in text, and press ⌘A you first select all the text in that block, but if you press ⌘A again (with that text selected), you expand to select all blocks. It's a cool feature and worth noting. |
It uses Ctrl+Alt+H (Edit: however, I wonder if it would conflict with the classic block) |
I'm not sure I see some of the keyboard shortcuts specific for keyboard navigation, e.g.:
and the ones to jump through the main landmark regions:
Worth noting #8005 is going to add a couple additional shortcut. I'd suggest to group al the shortcuts related to navigation under a group "Navigation". |
Can confirm it doesn't work with an Italian keyboard layout too. Worth noting using Tested on Window Chrome:
Given all the exploration made in #3218 I'd suggest to use two modifiers and a character-key. |
FWIW, here are what a few popular web apps do (not that we should necessarily copy other web apps, but just for testing purposes)…
@afercia @jasmussen Out of curiosity, does cmd or shift + forward slash work for you? (Not "does it work for you" in an "are you okay with that shortcut" sense, but from a practical/usability sense, like is it literally possible on your keyboard layouts?) |
No, also forward slash is placed differently in various keyboard layouts. See the link to the wikipedia page in #3218 (comment) |
I spent too much time looking into this today, and have come to the conclusion that I don't think there's an easy way to bind either Looking at how slack handles it, they use a different shortcut depending on the keyboard layout: I tested and in Italian and Danish layouts they use Google docs doesn't bother handling this at all. We could consider using
|
I personally think it's okay if the help shortcut doesn't work while typing. In fact I also think it's okay to not have a shortcut at all — you can access the More menu using the keyboard and then invoke the help modal from there. Perhaps in order to ship the improvement that is this modal in the first place, it would be good to remove the shortcut altogether and possibly revisit later? Did you try |
Is it easy to detect the keyboard layout and do what Slack does? Otherwise I reckon let's borrow the TinyMCE shortcut for now. |
I can't say with certainty because I'm not as skilled codewise as many of you are. And I would also love us to do this — it feels like the way superior solution. But my inkling is that it is extremely difficult, very onerous and time consuning, and prone to error as there are many many keyboard layouts we have to account for. Given how close we are to 5.0 deadlines, I'm thinking we should either keep things simple in order to ship improvements and iterate later, or just ship the improvements and be fine with not having any, or a clever, shortcut. |
…as the classic editor
Using newly introduced displayShortcutList function results in cleaner, better tested code
faf4976
to
3374379
Compare
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.
Love it! Great job.
const modifierKeys = castArray( modifiers ); | ||
|
||
await Promise.all( | ||
modifierKeys.map( async ( modifier ) => page.keyboard.down( modifier ) ) |
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.
Minor: There's no need for this to be an async
function, since the await
keyword is not used within the function's body.
Will open a separate issue. |
Description
Related issues - #71, #2980, #5420
Pressing
ctl+option+h
(shift+alt+h
on windows/linux) displays a modal detailing keyboard shortcuts.How has this been tested?
button is focused)
Screenshots
Types of changes
New feature (non-breaking change which adds functionality)
Checklist: