Skip to content

Commit

Permalink
don't blur if AT sent a fake down event at the location of a PDOM ele…
Browse files Browse the repository at this point in the history
  • Loading branch information
jessegreenberg committed Jun 7, 2018
1 parent e1916d5 commit e9f4544
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions js/input/Input.js
Original file line number Diff line number Diff line change
Expand Up @@ -1104,17 +1104,25 @@ define( function( require ) {
// If any node in the trail has accessible content
if ( trailAccessible ) {

// Starting with the leaf most node, search for the closest accessible ancestor from the node under the pointer.
for ( var i = eventTrail.nodes.length - 1; i >= 0; i-- ) {
if ( eventTrail.nodes[ i ].focusable ) {
focusableNode = eventTrail.nodes[ i ];
break;
// an AT might have sent a down event at the location of the PDOM element (outside of the display), if this
// happened we will not remove focus
var inDisplay = this.display.bounds.containsPoint( pointer.point );
if ( inDisplay ) {

// Starting with the leaf most node, search for the closest accessible ancestor from the node under the
// pointer.
for ( var i = eventTrail.nodes.length - 1; i >= 0; i-- ) {
if ( eventTrail.nodes[ i ].focusable ) {
focusableNode = eventTrail.nodes[ i ];
break;
}
}
}

// Remove keyboard focus, but store element that is receiving interaction in case we resume .
this.display.pointerFocus = focusableNode;
scenery.Display.focus = null;
// Remove keyboard focus, but store element that is receiving interaction in case we resume .
this.display.pointerFocus = focusableNode;
scenery.Display.focus = null;

}
}

sceneryLog && sceneryLog.Input && sceneryLog.pop();
Expand Down

0 comments on commit e9f4544

Please sign in to comment.