@@ -229,7 +229,7 @@ class Graph extends React.Component {
229
229
230
230
d3_select ( window ) . on ( "resize" , this . resizeSVG . bind ( this ) ) ;
231
231
this . div . on ( "click" , this . handleClickDiv . bind ( this ) ) ;
232
- d3_select ( document ) . on ( "keyup " , this . handleKeyUpDocument . bind ( this ) ) ;
232
+ d3_select ( document ) . on ( "keydown " , this . handleKeyDownDocument . bind ( this ) ) ;
233
233
this . div . on ( "mousemove" , this . handleMouseMoveDiv . bind ( this ) ) ;
234
234
this . div . on ( "contextmenu" , this . handleRightClickDiv . bind ( this ) ) ;
235
235
this . svg . on ( "mousedown" , this . handleMouseDownSvg . bind ( this ) ) ;
@@ -250,12 +250,11 @@ class Graph extends React.Component {
250
250
this . unSelectComponents ( ) ;
251
251
}
252
252
253
- handleKeyUpDocument ( d , i , nodes ) {
253
+ handleKeyDownDocument ( d , i , nodes ) {
254
254
var event = d3_event ;
255
255
if ( event . target . nodeName !== 'BODY' ) {
256
256
return ;
257
257
}
258
- event . preventDefault ( ) ;
259
258
if ( event . key === 'Escape' ) {
260
259
this . graphviz . removeDrawnEdge ( ) ;
261
260
this . unSelectComponents ( ) ;
@@ -285,6 +284,10 @@ class Graph extends React.Component {
285
284
else if ( event . key === '?' ) {
286
285
this . props . onHelp ( ) ;
287
286
}
287
+ else {
288
+ return ;
289
+ }
290
+ event . preventDefault ( ) ;
288
291
this . isDrawingEdge = false ;
289
292
}
290
293
0 commit comments