Skip to content

fix(UI): stuck keys#2123

Merged
alandtse merged 5 commits into
community-shaders:devfrom
SkrubbySkrubInAShrub:fix(UI)--UI-toggle-key-fix
Apr 15, 2026
Merged

fix(UI): stuck keys#2123
alandtse merged 5 commits into
community-shaders:devfrom
SkrubbySkrubInAShrub:fix(UI)--UI-toggle-key-fix

Conversation

@SkrubbySkrubInAShrub
Copy link
Copy Markdown
Collaborator

@SkrubbySkrubInAShrub SkrubbySkrubInAShrub commented Apr 15, 2026

fixes multiple cases of stuck keys:

  • When the menu is opened the release action was swallowed
  • When a new hotkey was assigned, the release action was also swallowed
  • When a new hotkey was assigned, it still registered the UI input related to that newly assigned key.

Closes: #2099

Summary by CodeRabbit

Bug Fixes

  • Improved hotkey capture and input handling to prevent keys from becoming stuck in the UI.
  • Fixed Enter/Escape behavior during initial setup so these keys work reliably.
  • Ensured toggling the menu clears lingering key states to avoid accidental repeated input.
  • Refined key event forwarding to reduce unintended UI side effects and more predictable hotkey behavior.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 15, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 54f6aea7-b951-4e9d-b6e2-5e3d3f30590e

📥 Commits

Reviewing files that changed from the base of the PR and between 2bf748c and 748083f.

📒 Files selected for processing (1)
  • src/Menu.cpp
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/Menu.cpp

📝 Walkthrough

Walkthrough

Adds a const query for hotkey-capture state and updates Menu::ProcessInputEventQueue to selectively suppress key-down forwarding (while still forwarding key-up), allow Enter/Escape during first-time setup, and clear ImGui input keys when toggling the menu to avoid stuck toggle keys.

Changes

Cohort / File(s) Summary
Hotkey Input Handling
src/Menu.h, src/Menu.cpp
Added bool Menu::IsCapturingHotkeyInput() const. Modified ProcessInputEventQueue() to: snapshot capture state, swallow key-downs for active hotkeys or during hotkey capture (except setup-close Enter/Escape), always forward key-up events, and call ImGui::GetIO().ClearInputKeys() when enabling the menu to avoid lingering held keys.

Sequence Diagram(s)

sequenceDiagram
    participant User
    rect rgba(200,220,255,0.5)
    participant InputQueue
    end
    participant Menu
    participant ImGuiIO as ImGui::IO

    User->>InputQueue: KeyDown/KeyUp events
    InputQueue->>Menu: Deliver event
    alt Menu is capturing hotkey input
        Menu->>Menu: IsCapturingHotkeyInput() == true
        alt Event is KeyDown and not Enter/Escape (setup-close)
            Menu-->>ImGuiIO: swallow (do not forward)
        else KeyUp or Enter/Escape
            Menu->>ImGuiIO: forward event
        end
    else Not capturing
        Menu->>ImGuiIO: forward all events (KeyDown/KeyUp)
    end
    Note right of Menu: On toggle-open -> Menu calls ImGui::GetIO().ClearInputKeys()
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • alandtse
  • doodlum

Poem

🐰 I nudge the keys and twitch my nose,

When menus open, stuck keys do go —
Enter/Escape in setup pass through,
Hotkeys hush their noisy cue,
ImGui clear, and onward we hop!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix(UI): stuck keys' directly addresses the main issue being fixed—stuck keys in UI input handling, which is the core problem described in the PR objectives and linked issue #2099.
Linked Issues check ✅ Passed The changes address all coding requirements in issue #2099: preventing the toggle key from being stuck when opening the menu by snapshotting hotkey capture state, suppressing key-down forwarding for active hotkeys, and clearing ImGui input state.
Out of Scope Changes check ✅ Passed All changes are directly related to fixing stuck key issues—adding a helper method to query hotkey capture state, modifying input event processing logic, and managing ImGui input state clearing.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

Automated formatting by clang-format, prettier, and other hooks.
See https://pre-commit.ci for details.
@SkrubbySkrubInAShrub SkrubbySkrubInAShrub changed the title Fix(UI): stuck keys fix(UI): stuck keys Apr 15, 2026
@github-actions
Copy link
Copy Markdown

No actionable suggestions for changed features.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

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 the current code and only fix it if needed.

Inline comments:
In `@src/Menu.cpp`:
- Around line 1093-1097: The printable character path still calls
io.AddInputCharacter() unconditionally during hotkey capture; update the logic
so fingerprint characters are suppressed using the same gate that blocks key
button events (the condition using isHotkey, event.IsPressed(),
wasCapturingHotkey, allowSetupCloseKey). Concretely, wrap or gate the
io.AddInputCharacter() call (and any related character-forwarding code) behind
that same boolean expression (or compute a local forwardKeyboard variable from
isHotkey/event.IsPressed()/wasCapturingHotkey/allowSetupCloseKey) so printable
keys do not reach ImGui while capturing a hotkey except when allowSetupCloseKey
permits it.
🪄 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 3534812c-fff2-4c46-a5d7-71254ef0294b

📥 Commits

Reviewing files that changed from the base of the PR and between 4c55cc7 and 2bf748c.

📒 Files selected for processing (2)
  • src/Menu.cpp
  • src/Menu.h

Comment thread src/Menu.cpp Outdated
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 15, 2026

✅ A pre-release build is available for this PR:
Download

@alandtse
Copy link
Copy Markdown
Collaborator

Please confirm this doesn't break combo keys. Like shift f10. Once someone confirms this works we'll merge. Thanks!

@SkrubbySkrubInAShrub
Copy link
Copy Markdown
Collaborator Author

just tested for that, works

@alandtse
Copy link
Copy Markdown
Collaborator

I also tested and seems to work on stuck key fix.

@alandtse alandtse merged commit 60bd93b into community-shaders:dev Apr 15, 2026
17 checks passed
@zndxcvbn
Copy link
Copy Markdown
Contributor

The problems are no longer reproducible, great job!

YtzyFvra pushed a commit to YtzyFvra/skyrim-community-shaders that referenced this pull request Apr 19, 2026
ParticleTroned pushed a commit to ParticleTroned/skyrim-community-shaders that referenced this pull request May 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

End key is getting stuck

3 participants