Skip to content

Commit

Permalink
fix(frontend,core): prevent scrolling when using arrow keys to move n…
Browse files Browse the repository at this point in the history
…odes (#1698)

* fix(frontend,core): prevent scrolling when using arrow keys to move nodes

Signed-off-by: braks <[email protected]>

* chore(changeset): add

Signed-off-by: braks <[email protected]>

---------

Signed-off-by: braks <[email protected]>
  • Loading branch information
bcakmakoglu authored Nov 29, 2024
1 parent 0d24680 commit 7cc1c5a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/clever-eyes-leave.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@vue-flow/core": patch
---

Prevent page scroll when using arrow keys to move nodes.
3 changes: 3 additions & 0 deletions packages/core/src/components/Nodes/NodeWrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,9 @@ const NodeWrapper = defineComponent({
nodeElement.value!,
)
} else if (isDraggable.value && node.selected && arrowKeyDiffs[event.key]) {
// prevent page scrolling
event.preventDefault()

ariaLiveMessage.value = `Moved selected node ${event.key.replace('Arrow', '').toLowerCase()}. New position, x: ${~~node
.position.x}, y: ${~~node.position.y}`

Expand Down

0 comments on commit 7cc1c5a

Please sign in to comment.