Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates MekHQ’s main Campaign GUI menu accelerators to avoid conflicts between Swing’s tab mnemonics (Alt+key) and menu item accelerators, addressing the hotkey clash described in #6712.
Changes:
- Switched many
JMenuItemaccelerators fromAlt+<key>toCtrl+<key>inCampaignGUI.initMenu(). - Updated the
initMenu()JavaDoc to document the rationale (avoiding conflicts withMHQTabTypetab mnemonics).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #8797 +/- ##
=========================================
Coverage 13.22% 13.23%
- Complexity 7874 7875 +1
=========================================
Files 1306 1306
Lines 169191 169139 -52
Branches 25458 25458
=========================================
- Hits 22383 22382 -1
+ Misses 144632 144579 -53
- Partials 2176 2178 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
This might be silly, but have you tested how this change interacts with playing a MegaMek scenario from MekHQ? If you use "CTRL-S" to save in a MegaMek scenario launched from MekHQ, will it trigger the save action on MekHQ too? |
I have not, but JMenuItem registers accelerators in the WHEN_IN_FOCUSED_WINDOW , which means only the focused window gets the event. Per Oracle docs: https://docs.oracle.com/javase/tutorial/uiswing/misc/keybinding.html |
Double checked in the programs themselves, saving in one with CTRL+S doesn't trigger the save on the other. |
psikomonkie
left a comment
There was a problem hiding this comment.
Nice! Thanks for double checking that for me. The ctrl-vs-alt situation just gave me a weird vibe, like it was intentional. Glad it won't be an issue!
|
@psikomonkie If you can merge for me, appreciated :) |

Addresses #6712
Some panels use ALT+KEY to open, like for example Interstellar Map (ALT+S). But that conflicts with ALT+S setup for save in the app menu. I have changed the critical menu shortcuts (CTRL+S, CTRL+N, CTRL+L) to use CTRL instead of ALT (the convention used in megamek) so there are no clashes. All other accelerators with Alt are removed because they were already conflicting with each other (multiple options registered to things like Alt+P). mnemonics still work as expected.