GeezerVison is showing github.com — Release held keys and mouse buttons when the game page loses focus by Sosotess93 · Pull Request #46 · NosCoreIO/NosCore.ClientLab
Conversation
Sosotess93
commented
Nov 21, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Fixes #52.
Problem
A key or mouse button released where the page cannot see it never reaches the game, which keeps believing it is down:
- Cmd+Shift+4 on macOS. The screenshot tool keeps the key-ups of Cmd and Shift, and the page does not even lose focus.
- While Cmd is held, macOS sends no key-up for the other keys.
- Cmd+Tab, or a click outside the window, while a key or button is down.
- A drag whose release never reaches the canvas: released outside the game, or a release an automation tool did not deliver (Left mouse button stays held after a drag, so later moves click #52).
What players see:
- After a macOS screenshot, Shift stays down for the game. Every click then acts in place (Shift+click), so the character no longer walks and the game looks frozen.
- After a stuck drag, plain mouse moves act as a held click: the character follows the pointer, and a window keeps pressing whatever is under it.
Change
recomp/web/index.html remembers which keys and buttons went down on the canvas and have not come back up, and sends their release (keyup, or mouse up) through the input ring when:
- a mouse or key event reports a modifier (Shift, Ctrl, Alt, Cmd/Win) as up while the game still holds it;
- a mouse move reports a held button as up (checked before the move is passed on);
- a button is released outside the canvas;
- Cmd is released, for every key still held;
- the window or the canvas loses focus, or the page is hidden.
Testing
In game, each case first reproduced on main:
- Cmd and Shift held, no blur (the screenshot case): on
main, clicks do not walk. With this change, the next click sends walk.
- Shift held, then a window
blur: the next click walks.
- Left button pressed with no release (Left mouse button stays held after a drag, so later moves click #52): on
main, plain mouse moves sent walk three times as the character followed the pointer. With this change, the same moves send nothing, and a real click on the ground still walks.
- The page loads and plays normally, including keyboard chat input and dialogs.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
coderabbitai
Bot
commented
Nov 21, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
Run configuration
-
- Source mode: Auto
- Repository: Unavailable
- Branch: Unavailable
- File: No configuration file from this repository applied
- Commit: Unavailable
- Layers: defaults
- Review profile: CHILL
- Plan: Advanced
- Run ID:
566af364-bc53-4fc6-b996-5c2483c5dc66
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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
-
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
A key or button released while the page is not focused never reaches the
game: a screenshot shortcut (Cmd+Shift+4), Cmd+Tab or a click outside the
window keeps the keyup for itself. The game then believes the key is still
down; a stuck Shift makes every click act in place, so the character no
longer walks.
The page now remembers which keys and buttons went down and sends their
release when the window or the canvas loses focus, or the page is hidden.
Cmd+Shift+4 on macOS does not take focus from the page: the screenshot
tool keeps the key-ups of Cmd and Shift, and no blur comes, so Shift stayed
down for the game. While Cmd is down, macOS also sends no key-up for the
other keys.
Every mouse and key event now compares the modifiers it reports with the
ones the game holds and releases those that are up. Releasing Cmd releases
every held key.
A drag whose release never reached the page (released outside the game, or
a release an automation tool did not deliver) left the button down for the
game, so later plain moves acted as a held click: the character followed the
pointer, a window kept pressing whatever was under it.
Each move now compares the buttons it reports with the ones the game holds
and releases those that are up before the move, and a release outside the
canvas is passed on too.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|