Skip to content

Commit

Permalink
setChildren shouldn't drop PDOM Nodes, reorganize screen view childre…
Browse files Browse the repository at this point in the history
…n setting, #141
  • Loading branch information
zepumph committed Oct 29, 2019
1 parent dcd467e commit 48882b2
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions js/gravity-force-lab/view/GravityForceLabScreenView.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,15 +126,9 @@ define( require => {
);

const massPositionsNode = new SpherePositionsPDOMNode();
this.addChild( massPositionsNode );
massPositionsNode.addChild( mass1Node );
massPositionsNode.addChild( mass2Node );

// the arrows and their labels should be above both masses (and their markers) but below
// the ruler and control panels
this.addChild( mass1Node.arrowNode );
this.addChild( mass2Node.arrowNode );

// @private - added to object for animation stepping
const gravityForceLabRuler = new ISLCRulerNode(
model,
Expand All @@ -147,15 +141,13 @@ define( require => {
snapToNearest: GravityForceLabConstants.LOCATION_SNAP_VALUE
}
);
this.addChild( gravityForceLabRuler );

const massControlsNode = new Node( {
labelTagName: 'h3',
labelContent: massControlsLabelString,
tagName: 'div',
descriptionContent: massControlsHelpTextString
} );
this.addChild( massControlsNode );

// the list of mass controls is aria-labelledby the its label sibling, see https://github.com/phetsims/gravity-force-lab/issues/132
massControlsNode.addAriaLabelledbyAssociation( {
Expand Down Expand Up @@ -241,7 +233,6 @@ define( require => {
minWidth: 170,
align: 'left'
} );
this.addChild( parameterControlPanel );

const resetAllButton = new ResetAllButton( {
listener: function() {
Expand All @@ -251,7 +242,20 @@ define( require => {
scale: 0.81,
tandem: tandem.createTandem( 'resetAllButton' )
} );
this.addChild( resetAllButton );

// child order
this.children = [
massPositionsNode,

// the arrows and their labels should be above both masses (and their markers) but below
// the ruler and control panels
mass1Node.arrowNode,
mass2Node.arrowNode,
gravityForceLabRuler,
massControlsNode,
parameterControlPanel,
resetAllButton
];

// PDOM Order
// All Nodes must be added as children (accessibleOrder alone won't word), but these don't need to be in the
Expand Down

0 comments on commit 48882b2

Please sign in to comment.