Skip to content

Commit

Permalink
Attach the Display KeyStateTracker to body, don't update in PDOMPoint…
Browse files Browse the repository at this point in the history
…er, see #1048
  • Loading branch information
jessegreenberg committed Apr 22, 2020
1 parent dab50b0 commit 09f4897
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 2 deletions.
1 change: 1 addition & 0 deletions js/display/Display.js
Original file line number Diff line number Diff line change
Expand Up @@ -1902,6 +1902,7 @@ Display.userGestureEmitter = new Emitter();
// @public (read-only) {KeyStateTracker} - A global object that tracks the state of the keyboard for all Displays. Use this
// to get information about which keyboard keys are pressed down and for how long.
Display.keyStateTracker = new KeyStateTracker();
Display.keyStateTracker.attachToBody();

/**
* Returns true when NO nodes in the subtree are disposed.
Expand Down
2 changes: 0 additions & 2 deletions js/input/PDOMPointer.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ class PDOMPointer extends Pointer {
if ( this.blockTrustedEvents && event.domEvent.isTrusted ) {
return;
}
Display.keyStateTracker.keydownUpdate( event.domEvent );

// set the target to potentially block keyup events
this.keydownTargetNode = event.target;
Expand All @@ -75,7 +74,6 @@ class PDOMPointer extends Pointer {
if ( this.blockTrustedEvents && event.domEvent.isTrusted ) {
return;
}
Display.keyStateTracker.keyupUpdate( event.domEvent );

// The keyup event was received on a node that didn't receive a keydown event, abort to prevent any other
// listeners from being called for this event. Done after updating KeyStateTracker so that the global state
Expand Down

0 comments on commit 09f4897

Please sign in to comment.