Skip to content

Add a keyboard shortcut to quickly open the Web IDE from any repo view

Problem to solve

GitHub recently introduced the ability to quickly open a web code editor by typing . while viewing any file in the repository. While we have the Open in Web IDE button on these views, it could become a pattern that people expect to find in GitLab.

Proposal

Open the Web IDE when someone types . on a repository view.

The Web IDE should open in the same tab.

  • This is similar to the default behaviour of the "Open in WebIDE" button. It is noted that this button is a link and thus users could choose to open link in new tab and this . flow would not have the similar option.

Questions

  1. Do we have any other shortcuts that would conflict here?
  2. Is there a different shortcut that makes sense?

More info

See this related HN thread

The implementation plan

  1. Add a hidden menu item in lib/sidebars/projects/menus/hidden_menu.rb. Use the properly constructed link to WebIDE for the project as link param
  2. Add a new keybinding to app/assets/javascripts/behaviors/shortcuts/keybindings.js under the project.* namespace, apparently since we want to open WebIDE for a repository, and not introduce it as a global keystroke
  3. Add the shortcut navigation as a Mousetrap binder to app/assets/javascripts/behaviors/shortcuts/shortcuts_navigation.js and connect it to the hidden menu item's CSS class using findAndFollowLink();
  4. Add the keystroke information into the documentation

Testing

Extensive test coverage required, including an E2E (see gitlab-org/quality/testcases#2250 (closed)). Running package-and-qa recommended on MR(s) to exclude regression.

Edited by Michael Le