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

Add failure test when using wire:model together with x-mask #7423

Conversation

luanfreitasdev
Copy link
Contributor

Review the contribution guide first at: https://laravel-livewire.com/docs/2.x/contribution-guide

1️⃣ Is this something that is wanted/needed? Did you create a discussion about it first?
#7100

2️⃣ Did you create a branch for your fix/feature? (Master branch PR's will be closed)
Yes

3️⃣ Does it contain multiple, unrelated changes? Please separate the PRs out.
No

4️⃣ Does it include tests? (Required)
Yes

5️⃣ Please include a thorough description (including small code snippets if possible) of the improvement and reasons why it's useful.

Livewire binds the value before the mask is applied when a mask is added to an input with a wire:model.
You can see the issue by accessing: https://wirebox.app/b/4j29y.
We can set a timeout for the dataset to make sure that the value is only returned after the mask has been applied.

Thanks for contributing! 🙌

@calebporzio
Copy link
Collaborator

ok I see the problem here, I think the solution is to change x-mask to override input events so that they are only fired after x-mask has already changed the input. Right? or do you think that would cause unwanted side effects in some way - it seems the cleanest and most robust to me though

@clinvest
Copy link

clinvest commented Jan 9, 2024

Hi, same problem here, using the mask feature through filamentphp: filamentphp/filament#10694

@kismonguz
Copy link

Hi, same problem here, using the mask feature through filamentphp: filamentphp/filament#10694

If you using money formatter, it will also mess up the thousand separator.

@calebporzio
Copy link
Collaborator

Thanks for the report and failing test - I was able to identify and fix it on the Alpine side.

Here's the alpine PR: alpinejs/alpine#3988

This fix will be included in the next release.

@jeffchown
Copy link
Contributor

Thanks, @calebporzio !

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

Successfully merging this pull request may close these issues.

6 participants