jackocnr / intl-tel-input

A JavaScript plugin for entering and validating international telephone numbers. React and Vue components also included.
https://intl-tel-input.com
MIT License
7.66k stars 1.95k forks source link

"Initial country" flag defaulting to the first country in the list #975

Closed davidferlay closed 5 years ago

davidferlay commented 5 years ago

Initialisation options

Steps to reproduce

Observed result

image

Expected result

Questions

jackocnr commented 5 years ago

What do you propose for the generic icon? And do you really think that would be a better experience for the user?

If you want to default to the user's country, see initialCountry=auto setting.

Otherwise I think defaulting to the first country makes sense. It makes it clear what the input is for and how it works and shows the user they need to change it.

davidferlay commented 5 years ago

Hi @jackocnr , thanks for such a quick answer)

What do you propose for the generic icon?

I propose the globe icon from this opensource collection : https://feathericons.com/?query=globe

Do you really think that would be a better experience for the user?

I do but it's only my opinion and I don't want to impose anything. I'd be happy to see other users to express their opinion

If you want to default to the user's country, see initialCountry=auto setting.

Thanks for pointing this out, i had missed it and it can cover additional use cases (like here)

Otherwise I think defaulting to the first country makes sense. It makes it clear what the input is for and how it works and shows the user they need to change it.

It does make sense indeed. In my humble opinion, it should however exclude values defined by preferredCountries. Especially since it has default values. Maybe resolution of this issue should only amount to fixing that, what do you think ?

jackocnr commented 5 years ago

it should however exclude values defined by preferredCountries

Why? The preferredCountries setting is for you to specify the most likely option to your users - surely it makes sense to default to the most likely option rather than Afghanistan?

Especially since it has default values

If the default values don't work for you, you should update them!

davidferlay commented 5 years ago

Is there any way to disable preferredCountries default values @jackocnr ? Without passing any country code i mean

jackocnr commented 5 years ago

Yeah you should be able to pass an empty array. Does that solve your problem?

davidferlay commented 5 years ago

This might)