Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JavaScript Alt key detection does not work #488

Open
JohnKlenk opened this issue Nov 14, 2023 · 0 comments
Open

JavaScript Alt key detection does not work #488

JohnKlenk opened this issue Nov 14, 2023 · 0 comments

Comments

@JohnKlenk
Copy link

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant