alpinejs / alpine

A rugged, minimal framework for composing JavaScript behavior in your markup.
https://alpinejs.dev
MIT License
27.92k stars 1.22k forks source link

Fix bug in X-Mask where user input that matched the non wildcard value were being stripped #4253

Closed robertmarney closed 3 months ago

robertmarney commented 3 months ago

Closes https://github.com/alpinejs/alpine/discussions/4252

Found where a non wildcard value matched the user input the value was being stripped, I added an additional check before stripping and added a couple test cases to the jest tests.

ekwoka commented 3 months ago

There isn't actually a bug. It was behaving as expected.

But this actually breaks behavior, but seemingly there weren't appropriate tests to catch that breakage.

robertmarney commented 3 months ago

There isn't actually a bug. It was behaving as expected.

But this actually breaks behavior, but seemingly there weren't appropriate tests to catch that breakage.

To confirm provided a user input of 3133133113' the expectation is the output is +1(333)133-113?

Perhaps its the special nature of the phone number input but we definitely see a large number of users that have the more 'raw' format stored in autocomplete (and we would like to leverage if we can and do with other masking tools)

image

image

robertmarney commented 3 months ago

Closing in favor of: https://github.com/alpinejs/alpine/pull/4260