Skip to content

Stop Cmd+Enter in the GitHub sync dialog from also running the workflow - #5293

Open
manziosee wants to merge 7 commits into
OpenFn:mainfrom
manziosee:fix/4836-cmd-enter-in-sync-dialog
Open

manziosee wants to merge 7 commits into
OpenFn:mainfrom
manziosee:fix/4836-cmd-enter-in-sync-dialog

Conversation

@manziosee

@manziosee manziosee commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

Description

This PR fixes Cmd/Ctrl+Enter in the GitHub "Save and sync" dialog also
running the workflow behind it.

The dialog handled Cmd/Ctrl+Enter with a plain onKeyDown on the commit
message textarea. That let the keypress carry on to the editor's own
Cmd+Enter (run) shortcut, so saving and syncing also started a run.

The dialog now registers its keys through useKeyboardShortcut at modal
priority (100) with enabled: isOpen, the same pattern as
DiscardChangesDialog and AlertDialog, so it claims them while open.
Cmd+Shift+Enter is claimed too: it still saves and syncs from the dialog, as
it did before, and no longer opens the run panel behind it. Holding the keys
down starts only one save and sync (the in-flight guard is a ref, so a key
repeat that arrives before the next render can't start a second one).

Closes #4836

Validation steps

  1. Open a workflow in a project connected to a GitHub repo.
  2. Open the Save & Sync dialog (button or Cmd/Ctrl+Shift+S).
  3. Type a commit message and press Cmd+Enter (Ctrl+Enter on Windows/Linux).
  4. The workflow saves and syncs, and no run is started.
  5. Open the dialog again and press Cmd+Shift+Enter: it saves and syncs, and
    the run panel does not open behind it.

Automated: new tests in Header.keyboard.test.tsx drive the real
Header with the dialog open. They fail on main (a run is submitted) and
pass with this change.

Additional notes for the reviewer

  1. Cmd+Enter now submits from anywhere in the open dialog, not only while
    the textarea has focus (for example after tabbing to Cancel). This
    matches the dialog's hint text.
  2. GitHubSyncModal.test.tsx now wraps renders in KeyboardProvider,
    which the dialog needs. The app already provides it in
    CollaborativeEditor.
  3. The 5 eslint errors reported in the touched test files are already on
    main and are unchanged here.

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)
  • I have updated the changelog.
  • I have ticked a box in "AI usage" in this PR

The dialog handled Cmd/Ctrl+Enter with a plain onKeyDown, which let the
keypress carry on to the editor's own Cmd+Enter (run) shortcut, so saving
and syncing also started a run. Register the dialog's keys through the
keyboard system at modal priority while it is open, so it claims them.
Cmd+Shift+Enter is claimed too, so it no longer opens the run panel
behind the dialog.

Fixes OpenFn#4836
Holding Cmd+Enter could start several save-and-syncs: the isSaving check
read React state, which a key repeat can outrun before the next render.
Guard with a ref that is set synchronously instead.

Cmd+Shift+Enter in the commit message saved and synced before this
branch, and the previous commit turned it into a no-op. It now syncs
again, and still does not open the run panel behind the dialog.
@github-project-automation github-project-automation Bot moved this to New Issues in Core Dec 2, 2026
MDEx rendered AI assistant messages in the legacy LiveView component,
which OpenFn#4908 removed. Nothing has called it since, and mix hex.audit now
fails on five advisories published for MDEx 0.13.3 on 30 Nov 2026, so
every PR's lint job fails.

Remove the dependency instead of upgrading it to 0.15.0, and drop mdex
and mdex_native from the lock file with mix deps.unlock --unused.

Closes OpenFn#4948
hex.audit fails on every branch while MDEx 0.13.3 is in the lock file.
This brings in OpenFn#5295's change so CI passes here too; it drops out of
this PR's diff once OpenFn#5295 is merged and main is merged in.
yaml_elixir 2.12.1 expands nested YAML aliases without a limit, so a
crafted file can exhaust memory. The advisory fails mix hex.audit in CI
lint. 2.13.0 carries the fix and fits the existing ~> 2.12 constraint,
so only mix.lock changes.

This branch has not been deployed

No deployments
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.

Pressing command+enter runs even when a the save & sync dialog is open

1 participant