Skip to content

Feat: shortcut dialog - #38203

Closed
ojeytonwilliams wants to merge 13 commits into
freeCodeCamp:masterfrom
ojeytonwilliams:feat/hotkey-legend
Closed

ojeytonwilliams wants to merge 13 commits into
freeCodeCamp:masterfrom
ojeytonwilliams:feat/hotkey-legend

Conversation

@ojeytonwilliams

@ojeytonwilliams ojeytonwilliams commented Feb 12, 2020 •

Copy link
Copy Markdown
Contributor

This adds a dialog showing commands and their shortcuts, accessible by shift + ?. It also closes #37398 by changing the 'navigation mode' shortcut from Escape to Alt + n.

Considerations:

  • Do we want to add an alternative way to trigger the dialog, perhaps an extra button inside 'Get Help'

TODO:

  • trigger search exclusively via react hotkeys
  • mount the hotkeys with the searchbar
  • include 'hotkeys' in the modal redux state

closes: #38842

@ojeytonwilliams ojeytonwilliams added scope: UI Threads for addressing UX changes and improvements to user interface platform: learn UI side of the client application that needs familiarity with React, Gatsby etc. labels Feb 12, 2020
@gitpod-io

gitpod-io Bot commented Feb 12, 2020 •

Copy link
Copy Markdown

@ojeytonwilliams

Copy link
Copy Markdown
Contributor Author

Hey, @ahmadabdolsaheb, any thoughts about the style and implementation? I just started from here and iterated until I had something I liked. Only then did I think about the other modals we use!

@ahmaxed

ahmaxed commented Feb 13, 2020

Copy link
Copy Markdown
Member

The functionality is great. a couple of considerations.
how would the users learn about shift + ? before opening the shortcuts modal? ( just a thought, although we could leave it for superusers to discover)
The div moves around when searching. probably it should resize from the bottom.

@ojeytonwilliams

Copy link
Copy Markdown
Contributor Author

how would the users learn about shift + ? before opening the shortcuts modal? ( just a thought, although we could leave it for superusers to discover)

I wasn't sure about that, because Quincy didn't want it to be too obvious, since the navigation hotkeys could encourage skipping challenges. That said, making the information public somewhere seems like a good idea.

The div moves around when searching. probably it should resize from the bottom.

Good point, I'll sort that out.

@ojeytonwilliams

Copy link
Copy Markdown
Contributor Author

@ahmadabdolsaheb it should look a bit better now.

The dialog hotkey is global, in part to ensure it is mounted when the
dialog appears and so appears in the list of hotkeys.

Also, alt+n is used for navigation mode instead of Escape as the latter
is an important VSCode hotkey.
Now the height can change, but the top of the dialog will not move.
Also refactors associated code.
@ojeytonwilliams

Copy link
Copy Markdown
Contributor Author

@scissorsneedfoodtoo hey Kris, I just realised I've made this clash with search. The dialog is triggered by ? but (because you're pressing shift+/) this moves focus to the search bar.

What do you think, should we limit search to s or is there a better hotkey for the hotkey legend?

@scissorsneedfoodtoo

Copy link
Copy Markdown
Contributor

@ojeytonwilliams, sorry for the late response.

I think limiting search to s sounds great. It's probably more intuitive for most people than / like it is now.

@ojeytonwilliams

Copy link
Copy Markdown
Contributor Author

Thanks, @scissorsneedfoodtoo, that seems reasonable, so I went with that and added s to the legend.

@ojeytonwilliams
ojeytonwilliams marked this pull request as ready for review March 30, 2020 08:51
@ojeytonwilliams
ojeytonwilliams requested a review from a team March 30, 2020 08:51
@moT01

moT01 commented Mar 30, 2020 •

Copy link
Copy Markdown
Member

Overall, I really like this feature and it's looking good. Some suggestions...

Screen Shot 2020-03-30 at 8 21 10 AM

  • A skinny window isn't utilizing all the space it could be ^^
  • I feel like I would like it more in direct center of the screen, or maybe the bottom right corner or something. It just doesn't feel right top-center (on desktop anyway).
  • I don't see a need for the filtering search since there's only nine items at the moment. I would get rid of that and center the title.
  • I think it could use an overlay to fade out the rest of the page when the modal is open, like the other modals.
  • clicking outside of the modal should close the box.
  • could maybe use a close button in there to close it as well.
  • possibly entering one of the shortcuts would close the modal as well?
  • I think the shortcuts should be all lowercase and abbreviated where they can be.
  • maybe a tiny bit more padding at the bottom to match the sides.
  • since we are adding this, we could probably get rid of the shortcut hints elsewhere...

Screen Shot 2020-03-30 at 8 52 42 AM

  • If we do that, "Execute Challenge" could be changed to "Execute/Submit Challenge"

@ahmaxed

ahmaxed commented Mar 31, 2020

Copy link
Copy Markdown
Member

Thanks for the pr,
we are planning to move code radio to learn which would add at least 4 more shortcuts, so having a search might not be a bad idea.
the UI could be similar to other modals (similar width and backdrop), with similar closing mechanism.

@ojeytonwilliams

Copy link
Copy Markdown
Contributor Author

@ahmadabdolsaheb I should have used a bootstrap modal in the first place. I'll redo it using that.

@moT01 I'll ping you once I've done that. Hopefully it should fix most of the problems you found.

@moT01

moT01 commented Mar 31, 2020

Copy link
Copy Markdown
Member

I still vote to remove the search, that's still only 13 items and can all fit on one screen. I'm just not seeing the usefulness of it.

@ojeytonwilliams

Copy link
Copy Markdown
Contributor Author

@moT01 I've made a few changes, I think it's a bit better now.

Still under discussion:

  • Remove other references to hotkeys?
  • Advertise this somewhere?
  • Keep the filter?

@raisedadead

Copy link
Copy Markdown
Member

I think its conventional to use / for search and s (with a modifier) for save.

@ojeytonwilliams

Copy link
Copy Markdown
Contributor Author

Okay, I'll see if I can do everything with react-hotkeys to avoid the clash.

@ghost

ghost commented Aug 2, 2020

Copy link
Copy Markdown

Hello! Jumped down a rabbit hole looking for shortcuts and ended up here! I RTFD'ed the comments above, and have tried:

  • Shift + ? | Jumps to search, as called out above
  • s | Jumps to search as well.

What esoteric key combination fires that gorgeous shortcut menu in @moT01's post?

This guide here, the "g.x.x" key combinations events don't seem to be firing for me, perhaps I'm missing something?

If someone could set me sorted on how to access the shortcut menu, I'd be one happy coder!

Love the site btw, hence my inquiry for all of the shortcuts! Thank you for your time, and I hope everyone is safe and healthy.

@ahmaxed

ahmaxed commented Aug 7, 2020

Copy link
Copy Markdown
Member

On the side note: these shortcuts could show up in the background when all editor tabs are unselected in the new next-curriculum editor.

@raisedadead

Copy link
Copy Markdown
Member

Closing this stale for now, for a head branch rename. Thanks for your PR.

@raisedadead raisedadead closed this Feb 1, 2021
@raisedadead raisedadead added the status: decayed Stale issues that need follow up from commentators. Were closed for inactivity label Feb 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

platform: learn UI side of the client application that needs familiarity with React, Gatsby etc. scope: UI Threads for addressing UX changes and improvements to user interface status: decayed Stale issues that need follow up from commentators. Were closed for inactivity

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Keyboard Shortcut to go back and forth between reading area and editor. Escape key unfocuses the editor when not meant to.

5 participants