Skip to content

fix(core): don't swallow input keystrokes held with a modifier - #2067

Open
bcakmakoglu wants to merge 1 commit into
release/2.0.0from
fix/key-press-inside-input
Open

fix(core): don't swallow input keystrokes held with a modifier#2067
bcakmakoglu wants to merge 1 commit into
release/2.0.0from
fix/key-press-inside-input

Conversation

@bcakmakoglu

Copy link
Copy Markdown
Owner

Fixes #1999.

Problem

While a modifier (e.g. Shift) is held, vue-flow's pan/zoom/selection/multi-selection key detection acted — and preventDefault-ed — even when the keydown targeted a page <input>. panActivationKeyCode defaults to Space and selectionKeyCode to Shift, and useKeyPress listens on document, so pressing Space with Shift held in any input on the page had its space swallowed (the input event never fired).

Fix

Pass actInsideInputWithModifier: false to the pan/zoom/selection (ZoomPane.vue) and multi-selection (Pane.vue) useKeyPress calls — the same option already used for deleteKeyCode. When a modifier is held and the event targets an input, the key detection now bails before preventDefault, deferring to the input. Behaviour over the pane/canvas is unchanged (the option only affects input-targeted events).

Verification

  • New regression test (keyPressInsideInput.cy.ts): types Shift+Space into an input beside the flow and asserts the space reaches the input. Confirmed it fails without the fix ('ab', space swallowed) and passes with it.
  • Full Cypress component suite green (160/160, Chrome); selection-via-Shift and pan/zoom over the canvas still work.

🤖 Generated with Claude Code

vue-flow's pan/zoom/selection/multi-selection key detection acted (and
`preventDefault`-ed) even when the keydown targeted a page input while a
modifier was held. Since `panActivationKeyCode` defaults to `Space` and
`selectionKeyCode` to `Shift`, pressing Space in an `<input>` anywhere on the
page with Shift held had its space swallowed — `useKeyPress` listens on
`document`, so any input was affected.

Pass `actInsideInputWithModifier: false` to those `useKeyPress` calls (the
pattern already used for `deleteKeyCode`), so they defer to the focused input.
Adds a regression test that types Shift+Space into an input beside the flow.

Fixes #1999.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@codesandbox

codesandbox Bot commented Jun 14, 2026

Copy link
Copy Markdown

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

@changeset-bot

changeset-bot Bot commented Jun 14, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: bf8aec3

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@vue-flow/core Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

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.

1 participant