2

The following code logs all keyboard, mouse, touch events.

On a Windows PC (tested: both Win10 + Win7), with a touchscreen (Samsung), I noticed that:

  • drag-and-drop works on the Desktop (Windows Explorer: you can select files) with a touch tap + drag

  • drag-and-drop doesn't work in Chrome:

    • doing a touch tap + drag doesn't trigger any event (not even a mousedown)
    • no touchstart, touchend, etc. are triggered

I already tried chrome.exe --touch-events without success, and the same for setting chrome://flags/#top-chrome-touch-ui to enable.

var a = document.getElementById("a");
var logEvent = e => { a.innerHTML = e.type + " " + (e.key ?? "") + " " + (e.code ?? "") + " " + (e.keyCode ?? "") + "<br>" + a.innerHTML; };
window.onkeydown = logEvent;
window.onkeyup = logEvent;
window.onkeypress = logEvent;
window.onmousedown = logEvent;
window.onmouseup = logEvent;
window.onmousemove = logEvent;
window.onclick = logEvent;
window.ondblclick = logEvent;
window.ontouchstart = logEvent;
window.ontouchend = logEvent;
window.ontouchmove = logEvent;
window.onpointerdown = logEvent;
window.onpointerup = logEvent;
window.onpointermove = logEvent;
<div id="a">
</div>
Basj
  • 41,386
  • 99
  • 383
  • 673

0 Answers0