2
0
mirror of https://github.com/tenrok/maska.git synced 2026-05-15 11:59:38 +03:00

fix: safari autofill bug

Safari doesn't fire input event on autofill of the fields like phone.
But there is a custom event with e.bubbles = true
and on our own custom event e.bubbles = false. So we can filter
Safari autofill event for the correct mask processing.
This commit is contained in:
Alexander Shabunevich
2024-10-04 17:59:05 +03:00
parent c6a6646b29
commit 6550be3719
+2 -1
View File
@@ -76,7 +76,8 @@ export class MaskInput {
private readonly onInput = (e: Event | InputEvent): void => {
// check both CustomEvent and isTrusted https://github.com/beholdr/maska/issues/227
if (e instanceof CustomEvent && e.type === 'input' && !e.isTrusted) {
// also check for bubbles because of Safari autofill bug https://github.com/beholdr/maska/issues/238
if (e instanceof CustomEvent && e.type === 'input' && !e.isTrusted && !e.bubbles) {
return
}