Skip to content

Commit

Permalink
compare focus trails instead of elements, see phetsims/john-travoltag…
Browse files Browse the repository at this point in the history
  • Loading branch information
jessegreenberg committed Mar 31, 2017
1 parent 6747c0f commit 53422f0
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions js/accessibility/AccessiblePeer.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,12 @@ define( function( require ) {
// make AccessiblePeer eligible for garabage collection
this.disposeAccessiblePeer = function() {

// blur the dom element if it currently in focus
if ( document.activeElement === self.domElement ) {
scenery.Display.focus = null;
// remove focus if the disposed peer currently has a focus highlight
if ( scenery.Display.focus &&
scenery.Display.focus.trail &&
scenery.Display.focus.trail.equals( self.trail ) ) {

scenery.Display.focus = null;
}

self.domElement.removeEventListener( 'blur', blurEventListener );
Expand Down

0 comments on commit 53422f0

Please sign in to comment.