Skip to content

Close the IDE with Cmd/Ctrl+E while the code editor has focus - #5129

Open
jadhavgaurav wants to merge 1 commit into
OpenFn:mainfrom
jadhavgaurav:fix/4959-cmd-e-closes-ide-from-monaco
Open

Close the IDE with Cmd/Ctrl+E while the code editor has focus#5129
jadhavgaurav wants to merge 1 commit into
OpenFn:mainfrom
jadhavgaurav:fix/4959-cmd-e-closes-ide-from-monaco

Conversation

@jadhavgaurav

Copy link
Copy Markdown

Description

This PR fixes Cmd/Ctrl+E so it closes the IDE while the Monaco editor has focus.

Two things were in the way:

  1. Monaco owns Cmd+E for its actions.findWithSelection ("Use Selection for
    Find") command, so the keydown never reached the app's keyboard system.
    addKeyboardShortcutOverrides already re-dispatches Cmd/Ctrl+Enter,
    Cmd/Ctrl+Shift+Enter and Cmd/Ctrl+K on window; Cmd/Ctrl+E now joins them.
    Cmd/Ctrl+F is deliberately left to Monaco, so the find widget is still one
    keystroke away.
  2. FullScreenIDE registered Escape, Control+e, Meta+e on a single handler
    that blurs Monaco when the editor has focus and only closes otherwise. Even
    with the key delivered, Cmd+E would have blurred instead of closing. The
    handler is now split: Escape keeps its step-out-then-close behaviour, and
    Mod+E always closes, mirroring the Mod+E that opened the IDE.

Closes #4959

Validation steps

  1. Open a job in the IDE (Cmd+E from a selected job, or click the step).
  2. Click into the code editor so Monaco has focus.
  3. Press Cmd+E (Ctrl+E on Windows/Linux). The IDE closes.
  4. Press Cmd+F with Monaco focused. Monaco's find widget still opens.
  5. Press Escape with Monaco focused. Focus leaves the editor; a second Escape
    closes the IDE, as before.

Additional notes for the reviewer

  1. New tests: assets/test/monaco/keyboard-overrides.test.ts covers the
    override registration and the dispatched event on both platforms, plus a
    guard that Mod+F is not claimed. FullScreenIDE.keyboard.test.tsx gains a
    "Mod+E - Close IDE" block. Five of these fail on main and pass here (I
    verified by reverting the two source files and re-running).
  2. assets checks run locally: the new and changed files are Prettier-clean and
    add no new ESLint or tsc --project tsconfig.browser.json errors (both files
    already carry pre-existing errors; the counts are identical before and
    after). I could not run mix checks: there is no Elixir toolchain on this
    machine, and nothing in this change touches Elixir.
  3. addKeyboardShortcutOverrides is also used by the manual run panel's custom
    dataclip editor, so Mod+E closes the IDE from there too. That seemed right;
    say the word if you'd rather scope it to the job editor.

AI Usage

Please disclose whether you've used AI anywhere in this PR (it's cool, we just
want to know!):

  • I have used Claude Code
  • I have used another model
  • I have not used AI

You can read more details in our
Responsible AI Policy

Pre-submission checklist

  • I have performed an AI review of my code (we recommend using /review
    with Claude Code)
  • I have implemented and tested all related authorization policies.
    (e.g., :owner, :admin, :editor, :viewer) — n/a, client-side
    keyboard handling only
  • I have updated the changelog.
  • I have ticked a box in "AI usage" in this PR

Monaco owns Cmd+E for "Use Selection for Find", so the keydown never
reached the application's keyboard system and the shortcut that opened
the IDE could not close it again. addKeyboardShortcutOverrides already
re-dispatches Cmd/Ctrl+Enter, Cmd/Ctrl+Shift+Enter and Cmd/Ctrl+K on the
window; Cmd/Ctrl+E now joins them. Cmd/Ctrl+F is left to Monaco, so the
find widget is still a keystroke away.

FullScreenIDE registered Escape and Mod+E on one handler that blurs
Monaco when the editor has focus and only closes otherwise, so even a
delivered Cmd+E would have blurred. The handler is split: Escape keeps
stepping out of the editor before it closes, and Mod+E always closes.

Closes OpenFn#4959
@github-project-automation github-project-automation Bot moved this to New Issues in Core Sep 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: New Issues

Development

Successfully merging this pull request may close these issues.

Command+e binding broken when Monaco is in focus

1 participant