From 0b9385abefe1b723996c97c0b27a985aa98474f7 Mon Sep 17 00:00:00 2001 From: Jesse Date: Fri, 11 Jan 2019 16:26:05 -0500 Subject: [PATCH] move setAccessibleViewsVisible to joist/Sim, see #442 --- js/Dialog.js | 27 ++------------------------- 1 file changed, 2 insertions(+), 25 deletions(-) diff --git a/js/Dialog.js b/js/Dialog.js index 4eee629f..08f6d07e 100644 --- a/js/Dialog.js +++ b/js/Dialog.js @@ -315,7 +315,7 @@ define( require => { // a11y - store the currently active element before hiding all other accessible content // so that the active element isn't blurred this.activeElement = this.activeElement || Display.focusedNode; - this.setAccessibleViewsVisible( false ); + this.sim.setAccessibleViewsVisible( false ); // In case the window size has changed since the dialog was hidden, we should try layout out again. // See https://github.com/phetsims/joist/issues/362 @@ -332,7 +332,7 @@ define( require => { this.isShowing = false; // a11y - when the dialog is hidden, make all ScreenView content visible to assistive technology - this.setAccessibleViewsVisible( true ); + this.sim.setAccessibleViewsVisible( true ); // Do this last this.hideCallback && this.hideCallback(); @@ -366,29 +366,6 @@ define( require => { Panel.prototype.dispose.call( this ); }, - /** - * Hide or show all accessible content related to the sim ScreenViews, navigation bar, and alert content. Instead - * of using setVisible, we have to remove the subtree of accessible content from each view element in order to - * prevent an IE11 bug where content remains invisible in the accessibility tree, see - * https://github.com/phetsims/john-travoltage/issues/247 - * - * @param {boolean} visible - * @private - */ - setAccessibleViewsVisible( visible ) { - for ( let i = 0; i < this.sim.screens.length; i++ ) { - this.sim.screens[ i ].view.accessibleVisible = visible; - } - this.sim.navigationBar.accessibleVisible = visible; - this.sim.homeScreen && this.sim.homeScreen.view.setAccessibleVisible( visible ); - - // workaround for a strange Edge bug where this child of the navigation bar remains visible, - // see https://github.com/phetsims/a11y-research/issues/30 - if ( this.sim.navigationBar.keyboardHelpButton ) { - this.sim.navigationBar.keyboardHelpButton.accessibleVisible = visible; - } - }, - /** * If there is an active element, focus it. Should almost always be called after the Dialog has been closed. *