From 6d8b988b09c8566db34a9f6881a327467c0cccab Mon Sep 17 00:00:00 2001 From: Sam Reid Date: Wed, 8 May 2024 13:45:38 -0600 Subject: [PATCH] Update focus order for the intro screen, see https://github.com/phetsims/density-buoyancy-common/issues/121 --- js/buoyancy/view/BuoyancyIntroScreenView.ts | 32 +++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/js/buoyancy/view/BuoyancyIntroScreenView.ts b/js/buoyancy/view/BuoyancyIntroScreenView.ts index 492ef1fd..746d5d4d 100644 --- a/js/buoyancy/view/BuoyancyIntroScreenView.ts +++ b/js/buoyancy/view/BuoyancyIntroScreenView.ts @@ -32,6 +32,8 @@ import ThreeUtils from '../../../../mobius/js/ThreeUtils.js'; import DensityBuoyancyCommonColors from '../../common/view/DensityBuoyancyCommonColors.js'; import BlockSet from '../../common/model/BlockSet.js'; import FluidSelectionPanel from './FluidSelectionPanel.js'; +import CuboidView from '../../common/view/CuboidView.js'; +import ScaleView from '../../common/view/ScaleView.js'; const MARGIN = DensityBuoyancyCommonConstants.MARGIN; @@ -89,9 +91,11 @@ export default class BuoyancyIntroScreenView extends DensityBuoyancyScreenView massView instanceof CuboidView ); + const scaleViews = this.massViews.filter( massView => massView instanceof ScaleView ); + + this.pdomPlayAreaNode.pdomOrder = [ + + // TODO: When the cuboids change from the radio buttons, this needs to update. So consider a different parent for this part + // see https://github.com/phetsims/density-buoyancy-common/issues/121 + ...cuboidViews.map( cuboidView => cuboidView.focusablePath ), + + blocksRadioButtonGroup, + + fluidSelectionPanel, + + // The blocks are added (a) pool then (b) outside, but the focus order is (a) outside then (b) pool + ..._.reverse( scaleViews.map( scaleView => scaleView.focusablePath ) ), + + displayOptionsPanel + ]; + + this.pdomControlAreaNode.pdomOrder = [ + this.readoutPanelsVBox, + this.resetAllButton + ]; } // Recalculate the space between the right visible bounds and the right side of the pool, for controls/etc to be positioned.