Register keyboard shortcuts on the Commit page
What does this MR do and why?
Rapid Diffs keyboard shortcuts were only wired on the merge request entry point. The Commit page never called initHotkeys(), so no shortcut worked there.
The commit entry now registers them. Three bindings stay out: next commit, previous commit and toggle-review are merge request specific, since their handlers read useMergeRequestVersions and write to useCodeReview, which carry no meaning on a commit. initHotkeys takes an optional mergeRequestShortcuts flag, defaulting to true so the merge request entry point is unchanged.
Related to #618786 (closed)
How to set up and validate locally
-
Open any commit touching several files, for example
/<group>/<project>/-/commit/<sha>. -
Click on an empty area of the page so no input has focus.
-
Check these work:
jor]for next filekor[for previous fileshift+dto toggle inline and side-by-side- select text inside a discussion, then
rto quote reply
-
Check these do nothing:
c(next commit)x(previous commit)v(toggle reviewed)
-
Force Rapid Diffs with
?rapid_diffs=true:/<group>/<project>/-/merge_requests/<iid>/diffs?rapid_diffs=trueThen
v,candxshould work.
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.