react-phone-input-2
react-phone-input-2 copied to clipboard
copy and paste phone number didn't work in firefox/macOS
The problem is with this function https://github.com/bl00mber/react-phone-input-2/blob/master/src/index.js#L644-L649 if you set copy numbers to false then it will work in FF. window.getSelection()
does not work in FF on input elements. Fastest fix would to probably just use the search value state variable const text = state.searchValue.replace(/[^0-9]+/g,'');
or you could use a querySelector to get the data but since you already have it in state probably not necessary const text = document.querySelector('#inputId').value.replace(/[^0-9]+/g,'');