vue-touch-events
vue-touch-events copied to clipboard
Suppress browser context menu when using touchhold
Browsers like Chrome will present the context menu on a long press, which conflicts with UI functions that expect the same. This happens on desktop and mobile. Would it be feasable to suppress the browser context menu when touchhold is used?
Using @contextmenu.prevent
on a component suppresses context so I suppose leave it to the package user to implement this, but perhaps document this.
So, is your issue solved? 🤔
Seems to be, but he kinda want them to document it somewhere =)
I have the same problem, but @contextmenu.prevent
don't work. It prevents also v-touch:touchhold
.
<my-component v-touch:touchhold='onLongTap' @contextmenu.prevent>
One working solution for mobile ad desktop browser
<my-component v-touch:touchhold='onLongTap' @contextmenu='onLongTap'>
with event handler:
export default {
methods: {
onLongTap(event) {
event.preventDefault()
/* do what you want here... */
},
}
}