This repository was archived by the owner on Aug 6, 2026. It is now read-only.
fix(terminal): stop Cmd+K clear from opening the command menu - #3436
Merged
Conversation
The terminal's custom key handler cleared the terminal on Cmd/Ctrl+K but only called preventDefault(), so the native keydown kept bubbling to the document-level mod+k hotkey, which opened the command menu on every clear. Add stopPropagation()/stopImmediatePropagation() in the k branch only. The w/r/1-9 branches intentionally return false so their events bubble to the global handlers, so they are left untouched. Generated-By: PostHog Code Task-Id: af84822e-2140-4b7d-8b01-2df4f2bff502
|
Merging to
After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here |
|
React Doctor found no issues in the changed files. 🎉 Reviewed by React Doctor for commit |
charlesvien
marked this pull request as ready for review
July 14, 2026 18:14
charlesvien
approved these changes
Jul 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Problem
Pressing Cmd+K to clear the terminal also popped the command menu open on top, every time. Two independent
mod+khandlers fired on a single keypress: the terminal's xterm handler cleared the terminal but only calledpreventDefault(), so the native keydown kept bubbling up to the document-levelmod+khotkey, which toggled the command palette open. The global binding had no terminal-focus guard.Changes
Add
stopPropagation()/stopImmediatePropagation()to thek+ cmdOrCtrl branch of the terminal's custom key handler, so a terminal clear no longer reaches the global command-menu hotkey. Thew,r, and1-9branches intentionally returnfalseso their events do bubble to global handlers (close tab, reload, switch tabs), so they're deliberately left untouched.How did you test this?
Added unit tests to
TerminalManager.test.tscovering the key handler: Ctrl+K clears the terminal and callspreventDefault/stopPropagation/stopImmediatePropagation, while Ctrl+W keeps bubbling. Ran the suite — all 6 tests pass (pnpm --filter @posthog/ui test src/features/terminal/TerminalManager.test.ts). Biome lint clean on the changed files.Automatic notifications
Created with PostHog Code from an inbox report.