From e01287300f7ffb3cf382d498bcfaa5a92e6c4beb Mon Sep 17 00:00:00 2001 From: samreid Date: Fri, 2 Jul 2021 11:26:23 -0600 Subject: [PATCH] updateLayout on next tick to work around layout problems, see https://github.com/phetsims/joist/issues/725 --- js/NavigationBarScreenButton.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/js/NavigationBarScreenButton.js b/js/NavigationBarScreenButton.js index 9a26ba8e..8bcf0179 100644 --- a/js/NavigationBarScreenButton.js +++ b/js/NavigationBarScreenButton.js @@ -8,6 +8,7 @@ * @author Chris Malley (PixelZoom, Inc.) */ +import animationFrameTimer from '../../axon/js/animationFrameTimer.js'; import DerivedProperty from '../../axon/js/DerivedProperty.js'; import Property from '../../axon/js/Property.js'; import Utils from '../../dot/js/Utils.js'; @@ -202,6 +203,10 @@ class NavigationBarScreenButton extends Node { screen.nameProperty.link( name => { text.text = name; updateLayout(); + + // For unknown reasons, the layout must be adjusted later than something else. Unclear what else is happening, + // but this seems to work until we have a better long-term solution here + animationFrameTimer.runOnNextTick( updateLayout ); } ); // pdom - Pass a shape to the focusHighlight to prevent dilation, then tweak the top up just a hair.