Global Hotkeys / Simulate keypress in JavaScript

  • How can you simulate a keypress event in JavaScript and send to krpano?

    I am trying maintain arrow movement and other key presses globally when an HTML element has been selected with a tabindex value. When another element has focus it does not send the keypress events to the pano element. How can you do this without re-focusing the element?

    Something like:

    const krpanoElem = document.querySelector("#pano");
    krpanoElem.dispatchEvent(new KeyboardEvent("keydown", {
      key: "ArrowLeft",
      bubbles: true,
      cancelable: true,

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!