Skip to content

Cannot set null or empty string on input fields with v-facade="['#####', '#####-####']" #70

@MatthewAry

Description

@MatthewAry

Describe the bug
Please see #67 for a description.
It is not possible to clear values that are bound to text input fields when using the directive strategy with a array of mask values.
Factors that may play a role in this bug:

  • Using a popular text input component from a component library like vuetify
  • Using the directive with an array of mask strings for a value

To Reproduce
Please see https://codepen.io/MatthewAry/pen/MWXOzJV for a reproduction.
Please type in a value in the input field, then click the reset button. The input field only accepts number. The reset button should set the value to an empty string.

Expected behavior
It's expected to see the input field clear when the reset button is clicked.

What actually happens
It is not clearing. The input is reapplying the value.

Looking at Vue DevTools timeline. We can see that for some reason the input field is re-applying the value the moment it's cleared. See the video below. In my video you can also see another interesting behavior relating to how editing other input fields on the same object is causing the misbehaving field to also re-apply its value. In my video all input fields are bound to an object that looks something like this.

...
    data:() => ({
      customer: {
        name: '',
        website: '',
        contractStart: '',
        contractEnd: '',
        gracePeriod: 0,
        address: '',
        addressTwo: '',
        city: '',
        state: '',
        zip: '',
        phone: '',
        fax: '',
      }
    }),
...

And it seems that it's reacting to changes in state in a shared object. My Codepen however, is able to demonstrate that this way of structuring reactive data not a pre-requisite to reproduce this issue.

Screenshots
Here is a recording of an interesting behavior related to what I am seeing.
https://user-images.githubusercontent.com/157217/202818102-e3923269-ee07-4148-8eaf-b896563ce671.mov

Desktop (please complete the following information):

  • OS: macOS
  • Browser Chrome
  • Version 107.0.5304.110 (Official Build) (x86_64)

Additional context
If you need more information I would be happy to provide it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions