Skip to content

Commit

Permalink
delay bluring active element as a workaround for Edge bug, see phetsi…
Browse files Browse the repository at this point in the history
  • Loading branch information
jessegreenberg committed Feb 5, 2018
1 parent 32712b9 commit 703f82d
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions js/accessibility/AccessibleInstance.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,14 +228,21 @@ define( function( require ) {
}

var parentElement = this.peer.getParentContainerElement();
parentElement.hidden = !( visibilityCount === this.trailDiff.length );

// if we hid a parent element, blur focus if active element was an ancestor
if ( parentElement.hidden ) {
if ( parentElement.contains( document.activeElement ) ) {
scenery.Display.focus = null;
// for some reason, wrapping the hiding and bluring in a timeout is a workaround for an Edge bug where unhidden
// elements remain excluded in the navigation order, see https://github.com/phetsims/a11y-research/issues/30
var self = this;
window.setTimeout( function() {
parentElement.hidden = !( visibilityCount === self.trailDiff.length );

// if we hid a parent element, blur focus if active element was an ancestor
if ( parentElement.hidden ) {
if ( parentElement.contains( document.activeElement ) ) {
scenery.Display.focus = null;
}
}
}
}, 1 );

},

/**
Expand Down

0 comments on commit 703f82d

Please sign in to comment.