fix: Escape handling after fullscreen exit#3892
fix: Escape handling after fullscreen exit#3892baculinivan-web wants to merge 1 commit intoopenfrontio:mainfrom
Conversation
WalkthroughInputHandler tracks fullscreen via a new wasFullscreen flag, adds a capturing Escape key handler to cancel active ghost builds, cancels ghosts on fullscreen exit, unregisters those listeners in destroy(), and tests assert cancellation, event emission, default prevention, and listener ordering including fullscreen-exit-before-Escape. ChangesGhost Structure Cancellation with Escape and Fullscreen Exit
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. 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. Comment |
da6d2d5 to
a0a351f
Compare
There was a problem hiding this comment.
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/client/InputHandler.ts`:
- Around line 856-868: In handleEscapeCapture (the capture-phase Escape key
handler) remove the call to event.stopImmediatePropagation() so it no longer
blocks other keydown listeners (like those that emit CloseViewEvent); keep
cancelGhostStructure() and event.preventDefault() but drop the
stopImmediatePropagation call and avoid redundantly setting ghost state here
since the regular handler calls setGhostStructure(null); use the existing
symbols handleEscapeCapture, cancelGhostStructure, isTextInputTarget, and
uiState.ghostStructure to locate and edit the handler.
🪄 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: 66278d45-10dc-4933-82f1-7a6aec812549
📒 Files selected for processing (2)
src/client/InputHandler.tstests/InputHandler.test.ts
a0a351f to
75570b5
Compare
75570b5 to
8c56a2e
Compare
Description:
This PR fixes Escape handling when the browser exits fullscreen mode.
Before this change, pressing
Escin fullscreen mode could be consumed by the browser fullscreen exit before the game handled it. As a result, in-game views and menus that normally close onEscstayed open until pressingEsca second time after fullscreen had already exited.This also affected structure placement: the active ghost building could remain stuck after fullscreen exit because the build state was not cleared at the same time.
The input handler now listens for
fullscreenchangeand emits the same close-view flow used by regularEschandling when fullscreen exits. If a ghost structure is active, it is cleared as well so placement state does not remain stuck.Added regression coverage for:
Esccancelling an active build ghost without blocking other keydown handlersPlease complete the following:
Please put your Discord username so you can be contacted if a bug or regression is found:
fghjk_60845