Skip to content

Commit

Permalink
call callbacks after doing internal logic, call interrupt on draggabl…
Browse files Browse the repository at this point in the history
…e and on grabbable, phetsims/gravity-force-lab#186
  • Loading branch information
zepumph committed Nov 5, 2019
1 parent e9deeeb commit 4801934
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions js/accessibility/GrabDragInteraction.js
Original file line number Diff line number Diff line change
Expand Up @@ -426,9 +426,6 @@ define( require => {
turnToGrabbable() {
this.grabbable = true;

// interrupt prior input, reset the key state of the drag handler by interrupting the drag
this.node.interruptInput();

// To support gesture and mobile screen readers, we change the roledescription, see https://github.com/phetsims/scenery-phet/issues/536
if ( supportsGestureA11y() ) {
this.node.setAccessibleAttribute( 'aria-roledescription', movableString );
Expand All @@ -446,8 +443,10 @@ define( require => {
this.node.addAriaDescribedbyAssociation( this.descriptionAssociationObject );
}

this.onGrabbable();
this.baseInteractionUpdate( this.grabbableOptions, this.listenersForDrag, this.listenersForGrab );

// callback on completion
this.onGrabbable();
}

/**
Expand All @@ -470,10 +469,11 @@ define( require => {
this.node.removeAriaDescribedbyAssociation( this.descriptionAssociationObject );
}

this.onDraggable();

// turn this into a draggable in the node
this.baseInteractionUpdate( this.draggableOptions, this.listenersForGrab, this.listenersForDrag );

// callback on completion
this.onDraggable();
}

/**
Expand All @@ -483,6 +483,9 @@ define( require => {
*/
baseInteractionUpdate( optionsToMutate, listenersToRemove, listenersToAdd ) {

// interrupt prior input, reset the key state of the drag handler by interrupting the drag
this.node.interruptInput();

// remove all previous listeners from the node
this.removeInputListeners( listenersToRemove );

Expand Down

0 comments on commit 4801934

Please sign in to comment.