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

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

Signed-off-by: braks <78412429+bcakmakoglu@users.noreply.github.com>

* chore(changeset): add

Signed-off-by: braks <78412429+bcakmakoglu@users.noreply.github.com>

---------

Signed-off-by: braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
Braks
2024-11-29 07:12:29 +01:00
parent 4d0978343f
commit 04d13551e3
2 changed files with 8 additions and 0 deletions

View File

@@ -0,0 +1,5 @@
---
"@vue-flow/core": patch
---
Prevent page scroll when using arrow keys to move nodes.

View File

@@ -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}`