maska icon indicating copy to clipboard operation
maska copied to clipboard

Browser tab freeze if element with v-maska is hidden with v-if

Open anatolykopyl opened this issue 2 years ago • 1 comments

Can be avoided by using v-show instead, but this is not a perfect solution.

For example I want to have a search input that is masked when I'm searching for hashtags and an unmasked input for everything else:

<template>
  <input
    v-if="category === 'hashtags'"
    v-model="query"
    v-maska="hashtagMask"
    type="text"
    placeholder="search"
  >
  <input
    v-else
    v-model="query"
    type="text"
    placeholder="search"
  >
</template>
<script>
export default {
  data() {
    return {
      category: 'all',
      query: '',
      hashtagMask: { mask: '!#H*', tokens: { H: { pattern: /[0-9a-zA-Zа-яА-Я_]/ } } }
    }
  }
}
</script>

This component will freeze the browser upon switching categories and entering text into the input without the v-maska directive.

anatolykopyl avatar Jun 25 '22 14:06 anatolykopyl

Turns out the issue only appears if there are 2 different inputs with v-mask. Also Vue 3 is not affected, I was only able to reproduce on Vue 2.

Reproduction link codesandbox

anatolykopyl avatar Jun 27 '22 20:06 anatolykopyl

I have released new major version (v2.0). If this issue still valid, please reopen it.

beholdr avatar Dec 04 '22 15:12 beholdr