JavaScript Alt key detection does not work
Opened this issue · 0 comments
JohnKlenk commented
Detection of Ctrl and Shift for key/mouse events work, but not Alt detection.
Here's example code you can load in the browser sample app:
<html>
<head><title>Ctrl/Alt/Shift detection test</title></head>
<body>
Click while holding Ctrl or Alt or Shift...<p>
<div id="test"></div>
<script>
function HandleClick(event)
{
let curtime = new Date().toLocaleTimeString();
if (event.ctrlKey) document.getElementById('test').textContent = Ctrl+click at ${curtime};
else if (event.altKey) document.getElementById('test').textContent = Alt+click at ${curtime};
else if (event.shiftKey) document.getElementById('test').textContent = Shift+click at ${curtime};
}
document.addEventListener('click', HandleClick);
</script>
</body>
</html>