Skip to content

Update keyboard shortcuts to use keybindings.js

What does this MR do?

Updates (almost) all current keyboard shortcuts to be defined in keybindings.js (added in !44527 (merged)).

This is an incremental piece of work towards #251226.

Most of the keybinding descriptions have been taken from the current keyboard shortcut dialog (accessible by pressing ?):

image

(Note: the descriptions aren't used anywhere in the app - yet.)

What doesn't this MR do?

This MR does not change any shortcuts or any shortcut-related behavior.

There are a few shortcuts that are implemented in less conventional ways that make a transition to keysFor a little trickier. These instances have been ignored for now in order to keep this MR as small as possible. Here are all the shortcuts skipped:

  • Monitoring shortcuts. Tricky because all shortcuts are handled by a single function.
  • MR/Web IDE "go to file" shortcut. Tricky because this shortcut requires a custom stopCallback function which hardcodes specific key codes.
  • Markdown editing shortcuts. Tricky because the Haml version of the markdown editor hardcodes its shortcuts in the Haml file, so it doesn't have a chance to call keysFor.

Screenshots

This MR makes no user-facing changes. All shortcuts should behave exactly as before.

More context

For more details about how keyboard shortcuts are implemented, see https://docs.gitlab.com/ee/development/fe_guide/keyboard_shortcuts.html#implementing-keyboard-shortcuts (also added in !44527 (merged)).

What's the big picture?

See !43348 (closed) for a better idea of how this MR fits into the larger picture.

Edited by Nathan Friend

Merge request reports