Loading
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.vuen/p(thread nav) -DiscussionNavigatorb(copy branch) -ShortcutsIssuablemod+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
- If you have not already opted in to Rapid Diffs, go to User Settings > Preferences > Diffs and enable Rapid Diffs
- Navigate to any merge request with multiple changed files (e.g.
http://localhost:3000/<group>/<project>/-/merge_requests/<iid>/diffs) - Press
]orjto jump to the next file; press[orkto jump to the previous file - Press
vto toggle the current file as reviewed (the checkbox should update and the file should collapse/expand accordingly) - Navigate to a commit view within the MR, then press
cto go to the next commit andxto go to the previous commit - 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