phetsims / joist

Joist is the main framework for PhET Interactive Simulations. Joist creates and displays the simulation content, home screen, navigation bar, About dialog, enables switching between tabs, and other framework-related features.
MIT License
8 stars 6 forks source link

Does isLeftToRightProperty respect fallbacks correctly? #862

Closed samreid closed 1 year ago

samreid commented 1 year ago

From https://github.com/phetsims/phet-io/issues/1881

@marlitas and I noticed this code:

const isLeftToRightProperty = new DerivedProperty( [ localeProperty ], locale => {
  // @ts-ignore keyof localeInfoModule not helping here.
  return localeInfoModule[ locale ].direction === 'ltr';
} );

We specified a non-existant locale “ar_MM” and expected to see it fallback to “ar”, but the isLeftToRightProperty crashed because it didn’t know about “ar_MM” specifically.

jonathanolson commented 1 year ago

I previously had localeProperty's validValues to be the set of locales in localeInfoModule, which would guarantee this behavior. To me, localeProperty taking on something not in localeInfoModule seems to be the error.

samreid commented 1 year ago

Thanks, I believe this will be addressed as part of https://github.com/phetsims/joist/issues/862, closing.

jonathanolson commented 1 year ago

Thanks, I believe this will be addressed as part of https://github.com/phetsims/joist/issues/862, closing.

That's... this issue. Did you mean another issue?

samreid commented 1 year ago

Yes, thanks. I think we will address it in https://github.com/phetsims/phet-io/issues/1882