Skip to content

fix(web): don't interrupt the running prompt when Escape closes a dialog#1559

Open
zbl1998-sdjn wants to merge 1 commit into
MoonshotAI:mainfrom
zbl1998-sdjn:fix/web-escape-dialog-no-interrupt
Open

fix(web): don't interrupt the running prompt when Escape closes a dialog#1559
zbl1998-sdjn wants to merge 1 commit into
MoonshotAI:mainfrom
zbl1998-sdjn:fix/web-escape-dialog-no-interrupt

Conversation

@zbl1998-sdjn

Copy link
Copy Markdown

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-level onKeyDown interrupts 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;, no stopPropagation). SearchSessionsDialog uses the design-system Dialog, which closes on the window bubble phase and also doesn't stopPropagation. So one Esc reaches both: the Dialog closes the popup and ConversationPane interrupts the task.

Fix: guard onKeyDown with openDialogCount — the same signal App.vue's anyOverlayOpen is built on — so ConversationPane doesn'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, and oxlint on the changed file are all clean.
  • End-to-end against a live local daemon (kimi server + this branch's web): with a prompt running, open the search popup and press Esc.
    • before: session statusaborted (task terminated mid-run).
    • after: session status stays running (dialog closes, task runs to completion).

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue, or explained the problem above.
  • I have added tests that prove my feature works. — kimi-web has no component-mount test harness (@vue/test-utils isn'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.
  • Ran gen-changesets skill, or this PR needs no changeset. — changeset included (web: prefix, bumps @moonshot-ai/kimi-code).
  • Ran gen-docs skill, or this PR needs no doc update. — no user-facing docs affected.

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
Copilot AI review requested due to automatic review settings July 11, 2026 18:40
@changeset-bot

changeset-bot Bot commented Jul 11, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: bf17f52

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@moonshot-ai/kimi-code Patch

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

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 openDialogCount to guard ConversationPane’s document-level Escape handler.
  • Add a patch changeset for @moonshot-ai/kimi-code describing 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).
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.

[Bug] Kimi Web 中 ESC 关闭搜索弹窗会终止当前运行任务

2 participants