disable doubleclick to fix zoom and scroll issues on doubleclick
document.addEventListener('dblclick', (e) => {
e.preventDefault();
});
document.addEventListener('contextmenu', (e) => {
e.preventDefault();
});
I also found that oncontextmenu
may be necessary to catch all instances for no
reason I can really tell.
This will eliminate context menus as well as some press-to-hold items for anchors and images (but not all)
<main class="app view" oncontextmenu="return false">
<router-view></router-view>
</main>
.app {
touch-action: none;
}
-webkit-touch-callout: none
will disable the context menususer-select: none
will fix a number of issues but may cause issues with<input>
or<textarea>
. Using:not(input, textarea) {}
may solve thisuser-drag: none
is a deprecated CSS that should work the same as settingdraggable="false"
on the element but it's more convenient to do this across the app in CSS
*,
*:before,
*:after {
box-sizing: border-box;
-webkit-touch-callout: none;
user-select: none;
}
a,
img {
-webkit-user-drag: none;
-khtml-user-drag: none;
-moz-user-drag: none;
-o-user-drag: none;
user-drag: none;
}