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

Tel input keeps getting focus #266

Closed
thomasledoux1 opened this issue Jan 22, 2019 · 7 comments
Closed

Tel input keeps getting focus #266

thomasledoux1 opened this issue Jan 22, 2019 · 7 comments

Comments

@thomasledoux1
Copy link

thomasledoux1 commented Jan 22, 2019

Hi,

We started using version 6.1.0 to be able to use the event itself when the onPhoneNumberBlur is triggered.
We currently have the following code setup:

<IntlTelInput
  className={this.getFormControlClasses('personalInformation.Phone')}
  type="tel"
  fieldId="personalInformationForm-phone"
  defaultCountry="auto"
  fieldName="Phone"
  placeholder={dictionary.get('Features.GlassBooking.PersonalInfo.Phone')}
  defaultValue={this.state.Phone}
  data-phonenumber={this.state.Phone}
  css={['intl-tel-input', this.getFormControlClasses('personalInformation.Phone')]}
  preferredCountries={['be', 'lu']}
  onlyCountries={['al', 'ad', 'at', 'by', 'be', 'ba', 'bg', 'hr', 'cz', 'dk',
    'ee', 'fo', 'fi', 'fr', 'de', 'gi', 'gr', 'va', 'hu', 'is', 'ie', 'it', 'lv',
    'li', 'lt', 'lu', 'mk', 'mt', 'md', 'mc', 'me', 'nl', 'no', 'pl', 'pt', 'ro',
    'ru', 'sm', 'rs', 'sk', 'si', 'es', 'se', 'ch', 'ua', 'gb']}
  utilsScript={'libphonenumber.js'}
  initialCountry={'auto'}
  geoIpLookup={(data) => { this.geoIpLookup(data); }}
  onPhoneNumberBlur={(status, value, country, number, id, event) => this.handlePhoneBlur(event, number)}
/>

However, when we focus any other (input) element on the page, the focus keeps going to the telephone input field. This behavior did not happen before we upgraded to 6.1.0. Do you have any idea why this could be happening? This only occurs on Safari (mobile and desktop).

@patw0929
Copy link
Owner

Thanks for point it out. It might be caused by #221.
As workaround, I comment out this part in TelInput.js and seems like works fine Safari:

  componentDidUpdate() {
    this.tel.setSelectionRange(
      this.props.cursorPosition,
      this.props.cursorPosition
    );
  }

Could you help to fix it? @superhit0

For clarify, I attach the error situation screenshot here:

(I use Safari here)

@superhit0
Copy link
Collaborator

@patw0929 Boss I am very busy this month, like neck deep in work, I am not sure I would be of any help this month.

PS:- If I get some time on weekends, I will try to pitch in.

@jlibrun22
Copy link

I downgraded to 5.0.7 to remediate this issue.

@patw0929
Copy link
Owner

@thomasledoux1 @jlibrun22:
We've published a hotfix as v6.1.1, please help to verify it 🙇

@phtmgt
Copy link

phtmgt commented Jan 25, 2019

6.1.1 works fine in my project!

@loris
Copy link

loris commented Jan 27, 2019

Also confirm that 6.1.1 fixed the issue on our end

@thomasledoux1
Copy link
Author

6.1.1 fixed the issue on our side too!
Thank you for the swift response.

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

No branches or pull requests

6 participants