Hi folks,
I have an SVG in the config screen of a new node, and when spending my time in that SVG I need to be able to respond to keyboard events.
-
Since an SVG element is no input-type, I need to add an
tabindex="0"
attribute to my SVG element (see Stackoverflow). However I never arrive in my event handler...svg.on('keydown', function(event) {... });
-
So I tried listening to all keyboard events on my window, but I also never arrive in my event.
$(window).on('keydown', function(evt) {...});
-
Finally listening to all keyboard events on my document works:
$(document).bind("keydown", function() {
...});`
From this I 'assume' that the event propagation towards my config screen window is somewhere stopped by Node-RED?
I am now wondering if option 3 is an acceptable approach? Have not digged into it further, but I assume I have to start taking into account that my handler should always be removed correctly, to avoid duplicate processings.
Thanks !!!
Bart