Åland has faulty data and takes priority over Finland
Currently Åland has missing and faulty data:
https://github.com/jackocnr/intl-tel-input/blob/3b4b46d41097b7e8dd19aef486bb57649daf5690/src/js/intl-tel-input/data.ts#L34
The correct numbers would be 18 and 457
Here's some Åland numbers for reference: https://visitaland.com/en/practical-info/internet-access-and-phonecalls/
Also, this causes a bug too. Finland has the same starting number but with only 4: https://github.com/jackocnr/intl-tel-input/blob/3b4b46d41097b7e8dd19aef486bb57649daf5690/src/js/intl-tel-input/data.ts#L444-L448
Currently this means Åland will ALWAYS be suggested first, and Finland never, because Åland comes first in the list and has the option "4" in it. The "4" should be removed and "457" added in Åland.
countryOrder does nothing to remedy the issue.
Also, it seems in other cases where other countries share mobile ranges, it does not show which one is actually selected because they use the same flag. In the case of Finland and Åland, Åland has its own flag, even thought it's part of Finland, so it matters.
I think there might be something else broken too since src/js/intl-tel-input/data.ts has prioritys that don't seem to do anything here:
//* Each country array has the following information:
//* [
//* iso2 code,
//* International dial code,
//* Priority (if >1 country with same dial code),
//* Area codes (string array), [OPTIONAL]
//* National prefix, [OPTIONAL - only required if using area codes]
//* ]
[
"ax", // Åland Islands
"358",
1,
["18", "4"],
"0",
],
[
"fi", // Finland
"358",
0,
["4"], // (mobile range shared with AX)
"0",
],
The documentation does not make clear which way the prioritys work, does higher number priority come first in the list or other way?
Hi there, thanks for raising this issue.
Åland will ALWAYS be suggested first, and Finland never
src/js/intl-tel-input/data.ts has prioritys that don't seem to do anything here
This led me to find a bug where the priorities were not being applied correctly, meaning that if you initialised the plugin on an input containing a number that was shared between two territories, then the highest priority territory was not always selected. This should now be fixed (e.g. if you initialise with the number "+3584570234567" which is shared between FI and AX, previously AX was selected, but now FI will be selected). This was released in v25.13.1.
in other cases where other countries share mobile ranges, it does not show which one is actually selected because they use the same flag
Can you give some examples of what you mean here? And what you think should be different?
As for just using "4" as the shared number range between FI and AX, instead of the more specific number ranges you mention - this is just a shorthand that gives the same results, but means I don't have to maintain every single area code range manually, as doing this for every country in the world would be a lot of work! But in the end, it shouldn't make any difference to the end user. Unless you have found a specific problem? In which case, please give details of how to reproduce it.
Great job for fixing the priority!
Can you give some examples of what you mean here? And what you think should be different?
I just mean that this probably was not noticed since the only indication which country is selected is the flag, and most countries with shared mobile ranges use the same flag.
What does the share range then even do? If we have a number "+3584570234567", it will always be Finland, right? So what's the point of Åland having it?
Great job for fixing the priority!
👍🏻
the only indication which country is selected is the flag, and most countries with shared mobile ranges use the same flag
Yeah, it's likely this occurs in some cases, but I don't see it as a problem - the user can hover the flag to see which country it's for, and select another one if they want.
What does the share range then even do? If we have a number "+3584570234567", it will always be Finland, right? So what's the point of Åland having it?
It just means that if the user selects Aland, then when they type an Aland number, it won't change the flag to Finland (whereas if they type a non-Aland area code, it will change to Finland). But yes, the downside is that if a user selects Aland, then types a number that is shared between Aland and Finland, then you save that number for them, then when they view that again, it will default to the Finnish flag. There's nothing we can do about that, but if this is really important to your use case, you would have to save the selected country as well as the number.
Is everything working now how you would expect, between Aland and Finnish numbers?
Is everything working now how you would expect, between Aland and Finnish numbers?
Yes, yes, if the priority is fixed then no need for anything else. We already have js fix to further show Ålandian numbers.
Thanks for your efforts!