Skip to content

Commit

Permalink
grunt update for a11y view robustness, phetsims/utterance-queue#1
Browse files Browse the repository at this point in the history
  • Loading branch information
zepumph committed Nov 20, 2019
1 parent 1fb3fe9 commit f34d618
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions ohms-law_a11y_view.html
Original file line number Diff line number Diff line change
Expand Up @@ -262,17 +262,14 @@ <h3>PDOM & Descriptions for Ohm's Law</h3>
if ( data.type === 'load' ) {

var simFrame = document.getElementById( 'iframe' );
var innerDoc = simFrame.contentDocument || simFrame.contentWindow.document;
var innerWindow = simFrame.contentWindow;

// copy of the parallel DOM
var PDOMRoot = simFrame.contentWindow.phet.joist.sim.display.accessibleDOMElement;
var PDOMRoot = innerWindow.phet.joist.sim.display.accessibleDOMElement;
var PDOMCopy = PDOMRoot.cloneNode( true );

// get the alert dom elements from the iframe's inner document
var politeElement1 = innerDoc.getElementById( 'elements-1-polite-1' );
var politeElement2 = innerDoc.getElementById( 'elements-1-polite-2' );
var politeElement3 = innerDoc.getElementById( 'elements-1-polite-3' );
var politeElement4 = innerDoc.getElementById( 'elements-1-polite-4' );
var ariaLiveElementsContainer = innerWindow.phet.joist.sim.display.utteranceQueue.getAriaLiveContainer();

// get the alert dom elements from the PDOM copy
var alertList = document.getElementById( 'alert-list' );
Expand Down Expand Up @@ -430,10 +427,9 @@ <h3>PDOM & Descriptions for Ohm's Law</h3>
}

// observe each of the live elements and add new text content to the list view
addLiveObserver( politeElement1, alertList );
addLiveObserver( politeElement2, alertList );
addLiveObserver( politeElement3, alertList );
addLiveObserver( politeElement4, alertList );
for ( let i = 0; i < ariaLiveElementsContainer.children.length; i++ ) {
addLiveObserver( ariaLiveElementsContainer.children[ i ], alertList );
}

// set focus to the loaded iframe
document.getElementById( 'iframe' ).focus();
Expand Down

0 comments on commit f34d618

Please sign in to comment.