beholdr / maska

Simple zero-dependency input mask for Vue, Svelte, Alpine.js and vanilla JS.
https://beholdr.github.io/maska/
MIT License
1.79k stars 71 forks source link

Safari AutoFill does not trigger an input event #238

Closed spektral3 closed 2 months ago

spektral3 commented 2 months ago

Describe the bug

Surprisingly, it seems that when autofilling in Safari, an input event is not fired by the browser, so the event handler is not being executed and therefore Maska doesn't do anything. Using this in combination with Vue, the input field is left empty because change detection is not being triggered.

Steps to reproduce

This should display an input field with a pretty yellow background and no mask applied.

Reproduction link

https://codepen.io/supra37/pen/PoMPWJd

beholdr commented 2 months ago

It seems a known Safari bug.

Safari doesn't fire input event, but there is a custom event with bubbles = true. And my own custom input events has bubbles = false. I've add check for bubbles to process mask in this case. Hope this will not break anything :) You can check it in 3.0.3 version.

spektral3 commented 1 month ago

Hey! Thanks for looking into the issue @beholdr. I just tested out v3.0.3 and it's working now 🥳