JSFiddle - React, Tailwind, and code Playground
HTML
<div>canvas:</div>
<canvas width="100" height="100"></canvas>
CSS
::selection {
background: transparent;
// color: currentColor;
}
::-moz-selection {
background: transparent;
// color: currentColor;
}
* {
user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
-o-user-select: none;
-webkit-user-select: none;
}
JavaScript
var elements = document.getElementsByTagName('*');
for (var i = 0; i < elements.length; i++) {
elements[i].setAttribute('unselectable', 'on');
}