How can I detect if the viewport (entire canvas including nodes) are in focus ? #1981
Unanswered
gitHoussem
asked this question in
Q&A
Replies: 1 comment
-
|
Problem here is that the Pane element is not focusable, thus you never see a "focusin" event happening when you click it. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi Team,
I am trying to find a way to know if the viewport (white pane + nodes + any element in the vueflow viewport) is in focus to be able to scope my keyboard shortcuts only to the canvas. I can't seem to find a way for that.
To be exact, I want to be able to do CRTL A/ and CTRL C to select all nodes and copy all nodes But I need the ctrl A and ctrl C to be scoped only on the viewport if the user has it on focus (and not do it in other inputs in the app)
The best I was able to do, is using vueuse/useFocusWithin but it is only able to detect that I am focused on the vueflow port If I click on a node.
Here is the sample code:
CleanShot.2025-10-30.at.12.07.55.mp4
<VueFlowDiagram>and<VueFlow>same behavior (no luck!)Thank you
Beta Was this translation helpful? Give feedback.
All reactions