fix(web): don't interrupt the running prompt when Escape closes a dialog#1559
Open
zbl1998-sdjn wants to merge 1 commit into
Open
fix(web): don't interrupt the running prompt when Escape closes a dialog#1559zbl1998-sdjn wants to merge 1 commit into
zbl1998-sdjn wants to merge 1 commit into
Conversation
ConversationPane's document-level Escape handler interrupts the running prompt, but didn't check whether a modal dialog owns Escape. App.vue's capture-phase handler deliberately leaves Escape for an open dialog to close itself, so with the session-search popup (or any Dialog) open, one Escape both closed the dialog AND interrupted the task. Guard onKeyDown with openDialogCount, mirroring App.vue's anyOverlayOpen check. Closes MoonshotAI#1538
🦋 Changeset detectedLatest commit: bf17f52 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
Pull request overview
Fixes a keyboard shortcut conflict in Kimi Web where pressing Esc to close a modal dialog (e.g., session search) could also abort an in-progress prompt, by preventing ConversationPane’s Escape-to-interrupt handler from running while a dialog is open.
Changes:
- Import and consult
openDialogCountto guardConversationPane’s document-level Escape handler. - Add a patch changeset for
@moonshot-ai/kimi-codedescribing the web behavior fix.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| apps/kimi-web/src/components/chat/ConversationPane.vue | Prevents Escape-to-interrupt from firing while a modal dialog is open (avoids aborting a running prompt when closing dialogs). |
| .changeset/web-escape-dialog-no-interrupt.md | Adds a patch changeset documenting the web fix. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+1030
to
+1032
| // A modal dialog open on top of the conversation owns Escape (it closes | ||
| // itself); don't also interrupt the running prompt underneath. Mirrors the | ||
| // `anyOverlayOpen` guard in App.vue's global capture-phase Escape handler (#1538). |
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Related Issue
Resolve #1538
Problem
See linked issue. In Kimi Web, pressing Esc to close the session-search popup (
Ctrl/Cmd+K) while a prompt is running also interrupts the running task.What changed
Root cause:
ConversationPane's document-levelonKeyDowninterrupts the running prompt on Esc (props.running || props.sending), but it didn't check whether a modal dialog owns Esc.App.vue's capture-phase global handler deliberately leaves Esc for an open dialog so the dialog can close itself (if (anyOverlayOpen.value) return;, nostopPropagation).SearchSessionsDialoguses the design-systemDialog, which closes on thewindowbubble phase and also doesn'tstopPropagation. So one Esc reaches both: theDialogcloses the popup andConversationPaneinterrupts the task.Fix: guard
onKeyDownwithopenDialogCount— the same signalApp.vue'sanyOverlayOpenis built on — soConversationPanedoesn't interrupt while a modal dialog is open. With no dialog open (openDialogCount === 0) the interrupt behaves exactly as before. It's a two-line change mirroring the existing guard.Verification
pnpm build:packages,pnpm --filter @moonshot-ai/kimi-web typecheck(vue-tsc),test(380 passed),check:style, andoxlinton the changed file are all clean.kimi server+ this branch's web): with a prompt running, open the search popup and press Esc.status→aborted(task terminated mid-run).statusstaysrunning(dialog closes, task runs to completion).Checklist
@vue/test-utilsisn't a dependency), so this keyboard interaction isn't unit-testable in the current setup; verified via the full gate plus the live before/after above.gen-changesetsskill, or this PR needs no changeset. — changeset included (web:prefix, bumps@moonshot-ai/kimi-code).gen-docsskill, or this PR needs no doc update. — no user-facing docs affected.