Skip to content

Add shortcuts to go to specific issue or merge request directly

What does this MR do?

Introduces two new keyboard shortcuts:

  • #: opens a modal dialog which prompts the user to input the issue id, and redirects the browser to the according location afterwards.

  • !: same for merge requests

The modal uses a form to trigger the form submission event when pressing ENTER while in the input field, so the user does not have to click on the OK button. When dismissing the modal (by pressing ESC or clicking the close button), no action is taken.

Filters user input to dismiss everything but digits. If an emtpy string is submitted or all characters are filtered out, no action is taken.

Are there points in the code the reviewer needs to double check?

Fixes one test expectation in spec/features/projects/shortcuts_spec.rb to actually check that the i shortcut redirects to the new issue path. This shortcut is not part of this MR, but I had problems (see #28307 (closed)) when running the spec file without this change; I suppose that in the previous version the expectation was instantly fulfilled, as Capybara finds the project's name somewhere on the page, so the test database teardown was started while FactoryGirl was still in the process of creating records.

Why was this MR needed?

The shortcuts g i (go to issue list) resp. g m (go to merge request list) are fine, but sometimes you know which issue or merge request you need, and you need them fast (image your project manager standing behind you).

With this MR, you can open the needed entity only with keyboard shortcut by quickly typing # 1234 ENTER.

Screenshots (if relevant)

Please see the following .webm file. First the shortcut # is used to go to issue no. 4, then the shortcut ! is used to go to merge request 1. You can also see the modal dialog in the video.

gitlab-proposal-add-shortcuts.webm

Does this MR meet the acceptance criteria?

What are the relevant issue numbers?

Closes #28737 (closed)

Merge request reports

Loading