Skip to content

fix(macos): close quick tools popup on first Escape while input is focused - #7454

Merged
M4n5ter merged 3 commits into
apache:mainfrom
MicroGery:fix/quick-tools-escape-close
Nov 30, 2026
Merged

M4n5ter merged 3 commits into
apache:mainfrom
MicroGery:fix/quick-tools-escape-close

Conversation

@MicroGery

@MicroGery MicroGery commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Quick Tools required two Escape presses when its native search input had focus. AppKit's cancelOperation: handler consumed the first press by blurring the field, so the window's close-on-Escape policy was never reached.

Route native input cancellation through the editor's actual window and share the dismissal order with unused Escape events from hosted views. For a window with closeOnEscape, inner modals/stacks handle Escape before the window closes. Composition and application key bindings retain priority; closeOnEscape=false keeps the existing field-blur behavior.

Verification

On a Mac mini running macOS 27.0.1:

  • Added eight real AppKit cases: empty/nonempty input, selected input text, multiline input, deterministic marked-text composition, closeOnEscape=false, an inner modal, and a custom Escape binding. All pass. The first-Escape assertion fails on the previous PR head ec5852c22e.
  • Ran the native suite from its owning NSH workspace:
    NSH_WINDOW_ESCAPE_CHECK_ONLY=1 cargo test --manifest-path third-party/nsh/Cargo.toml --locked -p nsh-platform-macos --no-default-features --features js,terminal --test native -- --ignored
  • Existing NSH_SELECTION_KEYS_CHECK_ONLY=1 checks pass. Scoped Rust formatting, staged ASF-header checks, and git diff --check pass.
  • Existing NSH_FOCUS_SELECTION_CHECK_ONLY=1 fails its same-turn tap-to-click selection assertion (1..1 instead of 0..5) on both this change and a freshly rebuilt, unmodified ec5852c22e.
  • The full desktop application builds successfully on the Mac mini; the packaged app passes strict code-signature verification. On macOS 27.2.1, the updated desktop client starts against the previously installed Host with the existing conversation list intact.
  • Full Host-upgrade validation on that existing Root is blocked by upstream database migration 60 (ALTER TABLE agent_recall_messages DROP COLUMN folded returning SQLITE_FULL); the migration rolls back. The local trial therefore pairs this client with the previously installed Host. This is not a claim that the full Host upgrade passes. The eight native cases above cover Escape; a physical global-shortcut product check remains manual.

AI use

  • No generative tool made a substantive contribution
  • Generative tooling made a substantive contribution

Codex helped implement the correction, add the native regression tests, and revise this description. The follow-up commit includes Generated-by: Codex.

Checklist

  • Tests cover the change and fail without it
  • Format, typecheck and the affected suites pass locally — scoped checks pass; the existing native click-selection failure is documented above.

Does this PR entail a breaking change or persisted-data migration?

  • Yes
  • No

Does this PR entail a change in behavior?

  • Yes — described under Summary above
  • No

…cused

When the Quick Tools popup (a Window with kind=popup / closeOnEscape)

had focus in its search input, pressing Escape was consumed twice:

first to blur/clear the text field, then a second time to close the

window.

Change the macOS platform layer to let Escape pass through the keymap

and navigation text-field handling so that a popup with closeOnEscape

closes on the first Escape press, regardless of input focus or content.
@github-actions github-actions Bot added the effort/S Under 100 readable lines label Nov 30, 2026
@github-actions github-actions Bot added effort/M Under 500 readable lines and removed effort/S Under 100 readable lines labels Nov 30, 2026
@MicroGery
MicroGery requested a review from M4n5ter November 30, 2026 06:49
@M4n5ter M4n5ter closed this Nov 30, 2026
@M4n5ter M4n5ter reopened this Nov 30, 2026

@M4n5ter M4n5ter left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Refactored focused Escape to pass window root explicitly without mutating input's event_root and trimmed redundant test cases; all 6 native AppKit window_escape cases verified locally.

@M4n5ter
M4n5ter merged commit 1d13bf1 into apache:main Nov 30, 2026
3 checks passed
@github-actions

Copy link
Copy Markdown

No description provided.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

effort/M Under 500 readable lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants