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:
+2
-1
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user