Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[suggestion] Option to disable autochange country when typing #269

Open
Styort opened this issue Nov 14, 2024 · 11 comments
Open

[suggestion] Option to disable autochange country when typing #269

Styort opened this issue Nov 14, 2024 · 11 comments

Comments

@Styort
Copy link

Styort commented Nov 14, 2024

I have set up a list of supported countries in the CountrySelectorNavigator (by passing a List<IsoCode> to countries parameter of CountrySelectorNavigator constructor ) and want to be able to enter a phone number for supported countries only. But if I start entering the phone number prefix of another country that I do not have in the list, it automatically changes to it.
Here is a video with an example of reproducing the bug.

Is is possible to disable now?

@cedvdb
Copy link
Owner

cedvdb commented Nov 14, 2024

What would be the expected behavior ?

What would it display when you do +1 ?

@Styort
Copy link
Author

Styort commented Nov 15, 2024

What would be the expected behavior ?

What would it display when you do +1 ?

Just continue displaying +1, without switching countries.

@cedvdb
Copy link
Owner

cedvdb commented Nov 16, 2024

What do you think about this :

  • change the country
  • when the user uses a country that is not in the list of selected countries, show an error message ?

@Styort
Copy link
Author

Styort commented Nov 16, 2024

I would not like to give the opportunity to change the country if it is not on the list of available ones.

I would like to be able to strictly limit the input of unsupported numbers so that the user immediately understands that the application is not available in his country.

I thought that's what the list of countries in CountrySelectorNavigator was for...

@Styort
Copy link
Author

Styort commented Dec 5, 2024

Any updates on this issue?
Are there plans to implement this feature? If yes, approximately when?

@cedvdb
Copy link
Owner

cedvdb commented Dec 5, 2024

Just continue displaying +1, without switching countries.

I'm not sure about this, it seems counter intuitive from an UX standpoint. I proposed before that it would change the country with an invalid message and not display the country in the list of countries. Or maybe something else entirely.

Are there plans to implement this feature? If yes, approximately when?

Can you implement it ? Let's land on a design for the first point of this comment first though.

@Styort
Copy link
Author

Styort commented Dec 5, 2024

I'm not sure about this, it seems counter intuitive from an UX standpoint.

What then is the point of the countries parameter in the CountrySelectorNavigator? After all, in the end, no matter what countries are in the CountrySelectorNavigator, I can select any one by writing its prefix. This behavior is confusing...

If you strictly prohibit changing the country when typing a prefix, if it is not in the list of allowed ones, then this can become breaking changes, which is not good. Therefore, I would suggest introducing a special flag for this. For example allowOnlySelectorNavigatorCountries or restrictCountriesByCountrySelectorNavigator (or you can suggest your own name) the default value of which will be false.

Can you implement it ?

I can try it when I have free time (maybe this month).

@cedvdb
Copy link
Owner

cedvdb commented Dec 5, 2024

What then is the point of the countries parameter in the CountrySelectorNavigator

It does not let the option to the user to select that country in the list

I can select any one by writing its prefix

Yes currently that's how it works, and it's not perfect. I'm still of the opinion that just writing +1 and not changing the country without any feedback to the user is a worst solution. If the input displayed an error message below like "This country is not allowed", at least there is a feedback, otherwise the user may conclude that typing a + does not work. That is why I suggest marking the field as invalid. If you have a better solution / user experience in mind let me know

@Styort
Copy link
Author

Styort commented Dec 6, 2024

I'm still of the opinion that just writing +1 and not changing the country without any feedback to the user is a worst solution.

I agree that displaying an error is a good option, but I wouldn’t want the country’s flag to change at the same time, and would simply leave the input field as is, but with an input error.

@cedvdb
Copy link
Owner

cedvdb commented Dec 6, 2024

Maybe we could disable the autochange for all countries (not just invalid ones), but that seems like a really niche use case ?

Let me explain why I think having a different behavior for valid and invalid countries would lead to bad UX:

We both agree that feedback should be conveyed to the user when he tries to enter an invalid country, an error message should therefor be shown, we agree on that part.

If that's the case, then the input is going to be in an invalid state whether or not the flag is changed. I'm arguing that the not changing the flag will be confusing for the following reasons:

  • The user may get confused and conclude that typing +"country code" doesn't work at all.
  • In the scenario where the user is not 100% sure about the country code this could lead to confusion. For example if an user types a phone number from his friend in France but for some reason thinks that the country dial code of france is +34, showing a spanish flag will be helpful (even if spain is invalid).
  • I do not see any added benefit of not including the flag change when there is an error message shown

So all in all I agree that a message should be shown but I believe there is value in changing the flag so the user can have feedback about where the country code he entered originates from.

@cedvdb cedvdb changed the title Option to disable autochange country when typing [suggestion] Option to disable autochange country when typing Dec 6, 2024
@KaiExa
Copy link

KaiExa commented Dec 12, 2024

Hi is it done added? for this feature

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants