Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Double input event when using v-maska directive #244

Open
JoaoHamerski opened this issue Nov 5, 2024 · 0 comments
Open

Double input event when using v-maska directive #244

JoaoHamerski opened this issue Nov 5, 2024 · 0 comments

Comments

@JoaoHamerski
Copy link

JoaoHamerski commented Nov 5, 2024

Describe the bug

When using the v-maska directive, the inputevent 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

#168

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant