Closed creative-guy closed 1 month ago
I have checked, and everything is working on my end. Could you please provide more details about the issue you're facing? Sharing the relevant code would be helpful as well.
Check here https://intl-tel-input.com/examples/strict-mode.html
Write some number, then put focus in between digits, and you would be able to break the mask
This is working as intended. I recently changed strictMode so it only blocks characters if the cursor is at the end, which will be the case the majority of the time. This was to fix the issue when if the user mistyped their country dial code, and then tried to go back and fix it, they were blocked from doing so because the number entered for the currently selected (incorrect) country was already at its max length: https://github.com/jackocnr/intl-tel-input/issues/1777
It would be too complicated to fix it so that it checks if adding the digit could potentially lead to a country change - that's too much complexity for this edge case, and I'd rather keep it simple.
Thanks for raising the point tho. I hope that makes sense. I'll close this for now.
Really doesn't make sense. What is the point of this strict mode mask, if it doesn't working in certain circumstances? Maybe at least do so, that cursor in the input would be automatically placed at the end, with no chance placing in between digits. And country change, should cut redundant digits I guess.
Ok I'll reopen this. I'm happy for the logic to be updated to the following:
When the user enters a new character: if the number is already at max length, then only allow the character if it changes the selected country. (or if they're adding a plus at the beginning)
I don't have time to implement this myself right now, but would welcome a pull request that added this functionality.
NOTE: I don't want to mess with the user's cursor position or start deleting their digits or anything like that, as I think the user might find that confusing.
Fix released in v24.5.1. Let me know if you have any problems.
https://intl-tel-input.com/examples/strict-mode.html
If you focus input, type something, get focus away, an then focus again, length is no more capped.