Open msaglietto opened 4 years ago
I am having this issue too. Any news on that? @msaglietto
I end up using https://github.com/ds300/patch-package and patching https://github.com/projectstorm/react-diagrams/blob/master/packages/react-canvas-core/src/core-actions/ActionEventBus.ts#L56
diff --git a/node_modules/@projectstorm/react-canvas-core/dist/es/core-actions/ActionEventBus.js b/node_modules/@projectstorm/react-canvas-core/dist/es/core-actions/ActionEventBus.js
index 9edc24e..4ad675c 100644
--- a/node_modules/@projectstorm/react-canvas-core/dist/es/core-actions/ActionEventBus.js
+++ b/node_modules/@projectstorm/react-canvas-core/dist/es/core-actions/ActionEventBus.js
@@ -43,12 +43,12 @@ class ActionEventBus {
}
else if (event.type === 'keydown') {
// store the recorded key
- this.keys[event.key.toLowerCase()] = true;
+ this.keys[event.key ? event.key.toLowerCase() : 'Unidentified'] = true;
return this.getActionsForType(Action_1.InputType.KEY_DOWN);
}
else if (event.type === 'keyup') {
// delete the recorded key
- delete this.keys[event.key.toLowerCase()];
+ delete this.keys[event.key ? event.key.toLowerCase() : 'Unidentified'];
return this.getActionsForType(Action_1.InputType.KEY_UP);
}
else if (event.type === 'mousemove')
Its only a safeguard for the event key I'm not sure if breake something but so far all seems good .. so if you find its a suitable solution I can submit a PR
Hello .. I encounter this strange issue where the canvas is reciving a key event without a key
How to Reproduce it: I have beside my graph a Modal .. that Modal has a TextField .. I was listening in the Input the keyboard change to make an action on Enter key down
So when you enter some content from the autocomplete where you selected with your mouse the text instead of typing... an Event is fired with Event.key = "Unidentified" and for some reason the event reach the graph (I think its because of https://github.com/facebook/react/issues/11387) with the key as undefined
I created a codesandbox to demo it: https://codesandbox.io/s/quirky-aryabhata-63315 but because of the
a.default is not a constructor
(please fix this) is not showing .. even if I added rescripts to modify the .babelrc to use sourceType unambiguous .. but it seems codesanbox ignore my rescripts changes ... so you will have to download the source from there to try it sorry =(