From 0d4f4ddd90da7c4aed5aa235492e8c88ce176437 Mon Sep 17 00:00:00 2001 From: zepumph Date: Thu, 3 Mar 2022 17:14:27 -0700 Subject: [PATCH] update cue visibility from inputEnabled, https://github.com/phetsims/scenery-phet/issues/720 --- js/accessibility/GrabDragInteraction.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/js/accessibility/GrabDragInteraction.js b/js/accessibility/GrabDragInteraction.js index 1d502051d..ee9fa6c05 100644 --- a/js/accessibility/GrabDragInteraction.js +++ b/js/accessibility/GrabDragInteraction.js @@ -148,7 +148,7 @@ class GrabDragInteraction extends EnabledComponent { // controls whether or not to show the "Grab" cue node that is displayed on focus - by // default it will be shown on focus until it has been successfully grabbed with a keyboard showGrabCueNode: () => { - return this.numberOfKeyboardGrabs < 1; + return this.numberOfKeyboardGrabs < 1 && node.inputEnabled; }, // whether or not to display the Node for the "Drag" cue node once the grabbable Node has been picked up, @@ -553,10 +553,16 @@ class GrabDragInteraction extends EnabledComponent { this.node.focusable = enabled; } ); + const boundUpdateVisibilityForCues = this.updateVisibilityForCues.bind( this ); + + this.node.inputEnabledProperty.lazyLink( boundUpdateVisibilityForCues ); + // @private this.disposeGrabDragInteraction = () => { this.node.removeInputListener( this.pressListener ); + this.node.inputEnabledProperty.unlink( boundUpdateVisibilityForCues ); + keyboardDragListener.dragEmitter.removeListener( dragListener ); // Remove listeners according to what state we are in