Double input event when using v-maska directive
### Describe the bug
When using the `v-maska` directive, the `input`event is triggered twice, this is a huge problem for Ajax requests that listen to input to do something, it'll do twice the request.
A workaround for that is conditionally emit the `update:modelValue` when `event.isTrusted`, this introduces another issue if you're using automated test tools like Cypress, because Cypress typing will always be `false` for `event.isTrusted`.
Also, it's a guess, but I think some extensions for auto-fill password like Bitwarden or Kaspersky Password Manager seems to be intercepting the type event, which leads to `isTrusted` `false`, so the workaround above isn't good in some scenarios:
- When you disable a button waiting for the input to be filled, if you conditionally trigger the `input` event when `event.isTrusted` is `true`, the button will always be disabled (this is the same scenario when using Cypress).
### Steps to reproduce
- Bind a input event to a input element
- Add a v-maska directive
- Every time you type something, it'll trigger twice the `input` event
### Reproduction link
See the console output after typing.
https://codepen.io/JoaoHamerski-the-lessful/pen/qBeMmrw
### Related
https://github.com/beholdr/maska/issues/168
关闭于 2025-10-07 0 条评论