jackocnr / intl-tel-input

A JavaScript plugin for entering and validating international telephone numbers
https://intl-tel-input.com
MIT License
7.38k stars 1.93k forks source link

Console error when using browser autofill #1586

Closed k-ivan closed 2 months ago

k-ivan commented 2 months ago

Steps to reproduce

  1. Create a small form with 3 fields. Field with name, phone and email. The browser must have this data for autofill.
  2. Accept the browser’s offer to insert data into the fields.

Example: https://codepen.io/k-ivan/pen/VwNqoBm?editors=1010

Expected behaviour

There are no errors in the console

Actual behaviour

An error appears in the console. The insert itself works successfully.

Uncaught TypeError: Cannot read properties of undefined (reading 'length')
    at t._handleKeydownEvent (intlTelInput.min.js:16:18929)

image

Initialisation options

  formatAsYouType: true,
  formatOnDisplay: true,
  strictMode: true,
  utilsScript: "https://cdn.jsdelivr.net/npm/intl-tel-input@21.2.6/build/js/utils.js"
jackocnr commented 2 months ago

Thanks for reporting. Fixed in v21.2.7.

k-ivan commented 2 months ago

Great, thanks a lot!