Skip to content

Instantly share code, notes, and snippets.

@artemsites
Last active May 28, 2024 15:35
Show Gist options
  • Save artemsites/018c4027bd54e250802bdc2c66826bd4 to your computer and use it in GitHub Desktop.
Save artemsites/018c4027bd54e250802bdc2c66826bd4 to your computer and use it in GitHub Desktop.
import setCaretPosition from '/src/utils/setCaretPosition'
export default function(e) {
let pos = e.target.value.search(/.(?=[^\d]*$)/)
if (pos < 4) {
// !@note асинхронный обход бага vue-imask на safari 17.1 когда при первом фокусе на vue-imask он ставит курсор в конец инпута телефона
setTimeout(() => {
setCaretPosition(e.target, 4)
}, 1)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment