Skip to content

fix: restrict Esc shortcut to editor context to fix dialog dismissal - #484

Merged
feigeCode merged 1 commit into
feigeCode:mainfrom
keenser:fix-esc-shortcut
Oct 30, 2026
Merged

feigeCode merged 1 commit into
feigeCode:mainfrom
keenser:fix-esc-shortcut

Conversation

@keenser

@keenser keenser commented Oct 29, 2026

Copy link
Copy Markdown
Contributor

Description

When the Esc key was bound globally, the Dismiss Transient UI shortcut had the highest priority in gpui and always won over the local Cancel actions of dialogs and lists. As a result, pressing Esc in the quick open dialog dismissed the editor's transient UI instead of closing the dialog itself.

This PR restricts the Esc shortcut to the MarkdownEditor key context only. It introduces a dedicated EDITOR_CONTEXT ("MarkdownEditor") that is set on the editor's root element and used by the shortcut definition, so the binding no longer intercepts key events outside the editor. A regression test was added to verify that Esc closes the quick open dialog.

How to Test

Run the story tests for the affected crates:

cargo run -p navop -- story

Specifically, verify the new regression test escape_closes_quick_open_dialog in main/src/home/home_connection_quick_open.rs:

cargo test -p navop escape_closes_quick_open_dialog

Manual check:

  1. Open the app and focus a Markdown editor.
  2. Press Esc inside the editor — transient UI is dismissed as before.
  3. Open the quick open dialog (e.g. connection quick open) and press Esc.
  4. Confirm the dialog closes instead of the editor's transient UI being dismissed.

Checklist

  • I have read the CONTRIBUTING document and followed the guidelines.
  • Reviewed the changes in this PR and confirmed AI generated code (If any) is accurate.
  • Passed cargo run for story tests related to the changes.
  • Tested macOS, Windows and Linux platforms performance (if the change is platform-specific)

Update global Esc shortcut to only apply within MarkdownEditor context.
This prevents it from overriding local cancel actions in dialogs and
lists. Add test to verify Esc closes the quick open dialog.
@feigeCode
feigeCode merged commit c5f4d7c into feigeCode:main Oct 30, 2026
8 checks passed
feigeCode added a commit that referenced this pull request Oct 31, 2026
冲突解决:main/src/home/home_tabs.rs 保留三产品拆分布局,快捷键复制改走
TabContainer::duplicate_active_tab(等价 #483:与标签菜单共用复制路径,终端保留当前工作目录,
并对任何可复制标签生效),复制出的终端标签在 main/src/home_tab/lifecycle.rs 补回
OpenSftp / SaveAsConnection 订阅;随之删除不再被使用的 ShellExtras::duplicate_terminal_tab 契约。

origin/main 上的 #482 / #483 / #484 其余改动(标签收缩、Esc 只在编辑器上下文生效、
terminal 测试隔离)均无冲突合入。

顺带修 main/src/home/home_tabs.rs 里 notify_unsupported 的属性与文档注释空行(clippy 告警)。
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.

2 participants