Add keyboard shortcuts to Rapid Diffs merge request app

What does this MR do and why?

Binds MR keyboard shortcuts in Rapid Diffs: file navigation (]/j, [/k), commit navigation (c/x), and toggle reviewed (v).

Current file is determined by comparing getBoundingClientRect().top against the sticky header bottom edge (via getCoveringElementSync). No wrap-around at boundaries, matching legacy behavior.

Already working (no changes needed)

These shortcuts are handled by shared components already used in Rapid Diffs:

  • f / shift+f (file browser) - FileBrowserToggle.vue
  • ; / shift+; (expand/collapse all) - DiffAppControls.vue
  • n / p (thread nav) - DiscussionNavigator
  • b (copy branch) - ShortcutsIssuable
  • mod+enter / shift+mod+enter (review/publish) - form-level

Deferred

  • mod+p / t (Go to file) requires the file finder modal UI, tracked separately.

How to set up and validate locally

  1. If you have not already opted in to Rapid Diffs, go to User Settings > Preferences > Diffs and enable Rapid Diffs
  2. Navigate to any merge request with multiple changed files (e.g. http://localhost:3000/<group>/<project>/-/merge_requests/<iid>/diffs)
  3. Press ] or j to jump to the next file; press [ or k to jump to the previous file
  4. Press v to toggle the current file as reviewed (the checkbox should update and the file should collapse/expand accordingly)
  5. Navigate to a commit view within the MR, then press c to go to the next commit and x to go to the previous commit
  6. Verify that shortcuts do not fire when typing in a text input or textarea

References

Closes #504200 (closed)

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Thomas Randolph

Merge request reports

Loading
Loading