catamphetamine / react-phone-number-input

React component for international phone number input
http://catamphetamine.gitlab.io/react-phone-number-input/
MIT License
915 stars 193 forks source link

Dial code getting added to input when clearing leading "+" sign #442

Closed manesid closed 3 months ago

manesid commented 3 months ago

Description:

When using countryCallingCodeEditable={false} to prevent editing of the country calling code, attempting to clear the leading "+" sign still results in the code being added back to the input.

Steps to Reproduce:

  1. Set countryCallingCodeEditable={false} on the react-phone-number-input component.
  2. Focus on the input field and move the cursor till + sign
  3. Try to clear the + sign using backspace

Expected Behavior:

Actual Behavior:

Code

<PhoneInput
  international
  countryCallingCodeEditable={false}
  defaultCountry="RU"
  value={value}
  onChange={setValue}/>

Additional Information The issue can be reproduced on https://catamphetamine.gitlab.io/react-phone-number-input/ Force international format section's 2nd example

https://github.com/catamphetamine/react-phone-number-input/assets/25284953/eef46796-f85a-4708-b040-5def6dc349db

catamphetamine commented 3 months ago

Published react-phone-number-input@3.3.10 with a fix.