From d73d6fc643306e149c3eede8706e6d107c978397 Mon Sep 17 00:00:00 2001 From: Jesse Date: Mon, 20 Sep 2021 13:00:25 -0400 Subject: [PATCH] interrupt KeyboardDragListener on blur, see https://github.com/phetsims/scenery/issues/1285 --- js/listeners/KeyboardDragListener.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/js/listeners/KeyboardDragListener.js b/js/listeners/KeyboardDragListener.js index 701609bb7..85af03c95 100644 --- a/js/listeners/KeyboardDragListener.js +++ b/js/listeners/KeyboardDragListener.js @@ -369,6 +369,16 @@ class KeyboardDragListener { this.resetPressAndHold(); } + /** + * Interrupts and resets the listener on blur so that listener state is reset and keys are removed from the keyState + * array. Public because this is called with the scenery listener API. + * @public + * + * @param {SceneryEvent} event + */ + blur( event ) { + this.interrupt(); + } /** * Step function for the drag handler. JavaScript does not natively handle multiple keydown events at once,