adobe/react-spectrum

'No Results' string not being localized within Combobox

noblefinsand opened this issue · 2 comments

Provide a general summary of the issue here

The "No Results" string in the Combobox component is not being localized according to the locale passed through the Provider component. We’ve found that when "English" is removed or moved down in the browser's language settings, the locale from the Provider component is correctly applied. However, when "English" is moved back to the top, the locale specified in the Provider component is no longer respected.

🤔 Expected Behavior?

The Combobox component's "No Results" string should always respect the locale passed through the Provider component, regardless of the browser's language settings. The string should be localized according to the specified locale, without being influenced by the presence or priority of "English" in the browser's language preferences.

😯 Current Behavior

The Combobox component's "No Results" string does not consistently respect the locale passed through the Provider component. For example, if locale="fr-FR" is set in the Provider and English is prioritized in the browser's language settings, the component defaults to English instead of using fr-FR. However, if English is removed or deprioritized in the browser's language settings, the component correctly applies the fr-FR locale.

💁 Possible Solution

No response

🔦 Context

Spectrum version: 3.21.2
Combobox: @react-spectrum/combobox@^3.12.3
Provider: @react-spectrum/provider@^3.9.5

We have also tested upgrading Spectrum to the latest version, as well as updating the Combobox and Provider components to their latest versions, but the issue persists.

🖥️ Steps to Reproduce

I can't seem to re-produce this in a Sandbox environment. This occurs in our primary application, so we are trying to understand why this is happening.

Version

3.21.2

What browsers are you seeing the problem on?

Firefox, Chrome, Safari, Microsoft Edge

If other, please specify.

No response

What operating system are you using?

Mac OS Ventura 13.3.1

🧢 Your Company/Team

No response

🕷 Tracking Issue

No response

I'm not sure what your application is doing, we'll either need a reproduction in codesandbox/stackblitz in order to assist, or more information about your setup.

You could do some debugging locally. Check
https://github.com/adobe/react-spectrum/blob/main/packages/%40react-aria/i18n/src/useLocalizedStringFormatter.ts#L41
https://github.com/adobe/react-spectrum/blob/main/packages/%40react-aria/i18n/src/context.tsx#L57
See what's coming through those lines.

The most likely issue though is that because context is involved, you have multiple copies of one or more of our packages installed. Can you check for duplicates installed in your node_modules, particularly @react-aria/i18n?

Feel free to reopen if you are able to reproduce. Closing for now.