I’m trying to add some accessibility to our diagram through some keyboard shortcuts. I’ve implemented the RobotJS as a class in my repo to assist. My end goal is to enable a user to simulate a drag and drop between two nodes of their choice. I initially chose to enable this by having a user be able to follow the steps below:
- Shift + 1 to create a connection from a selected node, continue holding Shift, create a mouseDown event at the selected Node’s port
- Automatically move the mouse to the next node in the diagram’s location
- Allow the user to use the S key to toggle to another node if desired, update mouseMove to new node
- Release shift, trigger mouseUp, create connection
This did not work, as everything worked fine up until step 3. That seems to be because triggering a mouseMove event prevents any keyboard inputs from being read. My additional S key presses to change the node did not come through, and releasing shift was not picked up.
I tested by just doing a drag event and seeing if any key presses would come through, and noticed they did not. I came up with another approach that combined all three mouse movements into one function triggered by a key combo that works, but it does not allow for the same visual experience as dragging from the port, as it instead has a user select Node A, store it as source, select node B store it as target, and then enter Shift + 1 to create the link.
I am curious if there is anything I can do to enable keyboard events to keep being processed even when mouseMove/down events have not completed, but understand that it might have larger implications and hence my backup method, while less visually appealing, has to remain.