UX Bug: ESC key should close diff modal before interrupting agent

Resolved 💬 3 comments Opened Nov 3, 2025 by kumaakh Closed Jan 9, 2026

Problem

When viewing a file diff in the Claude Code VSCode extension, pressing ESC causes two unintended actions:

  1. Closes the diff modal (intended)
  2. Interrupts the running Claude agent (NOT intended)

Expected Behavior

ESC key should follow standard modal focus hierarchy:

  • If a modal/dialog is open: ESC closes only the modal
  • If no modal is open: ESC interrupts the agent

Current Behavior

ESC triggers both the modal close AND agent interrupt simultaneously, causing frustration and workflow disruption.

User Impact

  • High frustration for keyboard-driven workflows
  • Forces users to use mouse to close modals (violates accessibility best practices)
  • Frequent unintended interruptions break flow state
  • Violates 40+ years of UI conventions (ESC closes topmost UI element first)

Steps to Reproduce

  1. Start a Claude Code session that shows file diffs
  2. Click "Show more" on a diff to open the diff modal
  3. Press ESC key expecting to close the modal
  4. Observe: Modal closes AND Claude agent is interrupted

Environment

  • Platform: Windows (likely affects all platforms)
  • VSCode extension: Claude Code
  • User workflow: Keyboard-heavy, minimal mouse usage

Suggested Fix

Implement proper event handling priority:

// Pseudocode
onEscapeKey(() => {
  if (isModalOpen()) {
    closeModal();
    event.stopPropagation(); // Don't propagate to global handlers
  } else {
    interruptAgent();
  }
});

Priority

Major UX issue - Affects core interaction pattern, impacts user productivity significantly.

Related

This follows standard UI toolkit behavior (React Modal, Bootstrap Modal, Windows dialogs, macOS dialogs, etc.)

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗