webcat12345 / ngx-intl-tel-input

Phone number input field to support international numbers, Angular
MIT License
213 stars 333 forks source link

Paste keyboard shortcuts do not work on Safari on Mac OS #489

Open abbasgalen opened 1 year ago

abbasgalen commented 1 year ago

Using paste keyboard shortcut does not work when using Safari on Mac OS.

The issue is due to the checks in onInputKeyPress(event: KeyboardEvent). This function allows characters such as c and v along with Ctrl key. However on Mac when using the command key the key.ctrlKey is false and so the check fails. the key.metaKey is true but is not used here. This issue does not exist in Chrome or Firefox on MacOs because pasting does not invoke the keypress event on those browser but it does on Safari.

The ideal fix would be to allow the Command key along with the Ctrl Key. essentially changing the check from !(event.ctrlKey && allowedCtrlChars.test(event.key)) to !((event.ctrlKey || event.metaKey) && allowedCtrlChars.test(event.key))

PT-WP commented 7 months ago

I've got the same problem, when this will get fixed?