Skip to content

Fix rebinded keys - #4175

Merged
evanpelle merged 4 commits into
openfrontio:mainfrom
TKTK123456:Fix-Rebinded-Keys
Jun 7, 2026
Merged

evanpelle merged 4 commits into
openfrontio:mainfrom
TKTK123456:Fix-Rebinded-Keys

Conversation

@TKTK123456

Copy link
Copy Markdown
Contributor

Before opening a PR: discuss new features on Discord first, and file bugs or small improvements as issues. You must be assigned to an approved issue — unsolicited PRs will be auto-closed.

Add approved & assigned issue number here:

Resolves #4174

Description:

I have fixed the rebinding of the keys for the build menu modifier and the emoji menu modifier in the settings so that they actually work.
And cleaned up the code

Please complete the following:

  • I have added screenshots for all UI updates
  • I process any text displayed to the user through translateText() and I've added it to the en.json file
  • I have added relevant tests to the test directory

Please put your Discord username so you can be contacted if a bug or regression is found:

tktk1234567

@coderabbitai

coderabbitai Bot commented Jun 6, 2026 •

Copy link
Copy Markdown
Contributor

Ready to act? Review this PR in Change Stack to turn feedback into patch suggestions you can inspect and refine.

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 4aa4a0f8-f20c-46e9-8f3e-c4d38b1fcc76

📥 Commits

Reviewing files that changed from the base of the PR and between b8d9371 and 499cc54.

📒 Files selected for processing (4)
  • src/client/HelpModal.ts
  • src/client/InputHandler.ts
  • src/client/UserSettingModal.ts
  • src/core/game/UserSettings.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/client/HelpModal.ts
  • src/client/InputHandler.ts

Walkthrough

Build and emoji radial menus now use configurable keybinds. Defaults were added for buildMenuModifier and emojiMenuModifier. InputHandler tracks those keybinds on keydown and checks their active state on pointer-up to emit menu events. Settings and Help UI show the new keybind entries.

Changes

Menu activation keybind refactor

Layer / File(s) Summary
Default keybind configuration
src/core/game/UserSettings.ts
getDefaultKeybinds now provides buildMenuModifier (MetaLeft on macOS, ControlLeft otherwise) and emojiMenuModifier (AltLeft), replacing the old modifierKey/altKey defaults.
Keyboard and pointer input routing
src/client/InputHandler.ts
InputHandler adds the build/emoji modifier key codes to its keydown allowlist and tracks them in activeKeys; on pointer-up it checks activeKeys.has(this.keybinds.buildMenu) / activeKeys.has(this.keybinds.emojiMenu) to emit ShowBuildMenuEvent / ShowEmojiMenuEvent. Removed isModifierKeyPressed and isAltKeyPressed helpers.
Settings and help modal keybind display
src/client/UserSettingModal.ts, src/client/HelpModal.ts
UI now exposes buildMenuModifier and emojiMenuModifier keybinds in the user settings and the Help hotkeys table, wiring defaults and displayed characters to the new action keys.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

Keys remapped, menus wake and hum,
Build and emoji answer drums.
From defaults to the UI shown,
Active keys now guide what's known.
Rebind, click, the radial comes. ✅

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title 'Fix rebinded keys' is vague and generic, using imprecise language that doesn't clearly convey the specific changes made (modifier key handling updates). Improve the title to be more specific about the fix, such as 'Fix build and emoji menu rebinding by tracking keybind state instead of modifier flags' for better clarity.
✅ Passed checks (3 passed)
Check name Status Explanation
Description check ✅ Passed The description clearly relates to the changeset by explaining that rebinding keys for build and emoji menu modifiers was fixed and code was cleaned up.
Linked Issues check ✅ Passed The PR successfully addresses both primary requirements from issue #4174: fixing rebound emoji/build menu keys to work correctly [#4174] and cleaning up Alt/Ctrl modifier-key handling [#4174].
Out of Scope Changes check ✅ Passed All changes are directly related to fixing rebinding functionality and cleaning up modifier-key handling as specified in issue #4174; no unrelated changes detected.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/core/game/UserSettings.ts`:
- Around line 37-38: Add unit tests for UserSettings.getDefaultKeybinds (or the
exported keybinds function) that assert the exact default values for buildMenu
and emojiMenu for both platforms: call with isMac = true and expect buildMenu
=== "MetaLeft" and emojiMenu === "AltLeft", and call with isMac = false and
expect buildMenu === "ControlLeft" and emojiMenu === "AltLeft"; place tests
alongside existing UserSettings tests and reference the
getDefaultKeybinds/keybinds symbol to locate the implementation.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 97b4a585-1657-45ed-b147-3f756c3b8273

📥 Commits

Reviewing files that changed from the base of the PR and between ee8c283 and b8d9371.

📒 Files selected for processing (4)
  • src/client/HelpModal.ts
  • src/client/InputHandler.ts
  • src/client/UserSettingModal.ts
  • src/core/game/UserSettings.ts

Comment thread src/core/game/UserSettings.ts Resolved
@github-project-automation github-project-automation Bot moved this from Triage to Development in OpenFront Release Management Jun 6, 2026
@github-project-automation github-project-automation Bot moved this from Development to Final Review in OpenFront Release Management Jun 7, 2026
@evanpelle evanpelle added this to the v32 milestone Jun 7, 2026
@evanpelle
evanpelle merged commit 8115b75 into openfrontio:main Jun 7, 2026
11 of 12 checks passed
@github-project-automation github-project-automation Bot moved this from Final Review to Complete in OpenFront Release Management Jun 7, 2026
@TKTK123456
TKTK123456 deleted the Fix-Rebinded-Keys branch June 7, 2026 01:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Complete

Development

Successfully merging this pull request may close these issues.

Cleanup Alt and Ctrl (modifier key) stuff

2 participants