robinrodricks / vue3-touch-events

Simple touch events support for vue.js 3
MIT License
216 stars 27 forks source link

confirm inside v-touch:hold-handler prevents at least the execution of one subsequent v-touch:hold-event in chrome #3

Open lsblsb opened 2 years ago

lsblsb commented 2 years ago

System: Windows 10 / Chrome 92.0.4515.131

Problem: A windows.confirm() inside a v-touch:hold handler prevents at least the execution of one subsequent v-touch:hold-event in chrome. This even happens when i place the confirm() call inside a setTimeout() function.

It works perfectly with firefox.

Example (snippets):

<button v-touch:hold="onTouchHold">TEST</button>
methods: {
    onTouchHold() {
      console.log("touchhold")
        if (confirm("Confirm?")) { //works without...
          this.variable = 1
        }                          //...this if-confirm-block
    },
}
robinrodricks commented 2 years ago

Call the confirm() in an async function or callback set with setTimeout.