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

Can't erase phone number with formatOnDisplay = true #23

Closed
s-o-f opened this issue Aug 20, 2021 · 3 comments
Closed

Can't erase phone number with formatOnDisplay = true #23

s-o-f opened this issue Aug 20, 2021 · 3 comments
Labels
bug Something isn't working invalid This doesn't seem right

Comments

@s-o-f
Copy link

s-o-f commented Aug 20, 2021

Actual behavior

Can't erase phone number

Steps to reproduce

Enter phone number: +79111188888 (can be copy-pasted)
Try to erase last digit (press backspace)
out

intl-tel-input-ng version

0.4.0

@mpalourdio
Copy link
Owner

Thanks for this clear bug report, kudos! Looks like the bug is not here, but in the main library.
I have tried here : https://accounts.intuit.com/signup.html, and the same bug appears, whereas they do not use my integration for angular.

You should report the bug in the main repo here instead.

Thanks.

@mpalourdio mpalourdio added the invalid This doesn't seem right label Aug 20, 2021
@s-o-f
Copy link
Author

s-o-f commented Aug 20, 2021

Looks like the bug is not here, but in the main library.

I don't think so.
I can't reproduce this on official demo page https://intl-tel-input.com/

Looks like here https://accounts.intuit.com/signup.html they are using something like these hack that leads to the bug.

I found temporary solution for your component. It works, but not tested carefully.
Remove these:

if (!!value) {
      this._intlTelInput.setNumber(value);
    }

Add these:

keyUp() {
    if (this._intlTelInput.isValidNumber()) {
      this._intlTelInput.setNumber(this._intlTelInput.getNumber());
    }
  }

And add input attributes:

(keyup)="keyUp($event)"
(change)="keyUp($event)"

@mpalourdio
Copy link
Owner

mpalourdio commented Aug 20, 2021

Yes it is. The bug is caused by the auto-format feature in the lib, which the demo page does not use. That what this thread is all about.

We could to try to implement your hack, but it needs to be battle tested

@mpalourdio mpalourdio reopened this Aug 20, 2021
@mpalourdio mpalourdio added the bug Something isn't working label Aug 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

2 participants