onHold "up" event not firing after onPressed event

Related app/team name (not a must if you want to keep it private): Insights Capture

Issue Description:

The onHold event for hotkeys doesn’t fire the “up” state if the onPressed event is triggered for another hotkey.

I want to use the hold hotkey in combination with press hotkeys to trigger certain actions within the app.

Can you reproduce it (exact steps to reproduce):

  • build modified sample-app (GitHub - fgfl/sample-app at fredericklee/onHoldEvent-no-up-state-bug)
  • load as unpacked and run
  • look at logs for background window
  • while in a game, press the “T” hotkey to trigger onHold “up” and “down” event
  • hold “T” to trigger only “down” onHold event
  • press “Y” to trigger onPressed event
  • let go to “T”
  • onHold “up” event is expected but doesn’t happen

image
Output looks like this. There’s not “up” onHold event if the onPressed event is fired.

Do you currently have a workaround?

I can use a timeout to group hotkey presses, but that doesn’t work very well because it requires the user to press the hotkeys within a time window and not press any hotkeys afterwards until the timeout ends.

There is another issue when using two hold hotkeys. I will use 1 and 2 as examples for the hold hotkeys.

Pressing: Results in below events
1 hold 1, state: “down”
2 hold 2, state: “down”
2 release 2, state: “up”
1 release no events fired

The 1 hotkey doesn’t fire the “up” event in this case.

Pressing Results in
1 hold 1, state: “down”
2 hold 2, state: “down”
1 release 1, state: “down”
1, state: “up”
2 release 2, state: “down”
2, state: “up”

There are extra “down” events fired event.

is it Desktop window or in-game window?

This happens in in-game windows.

it seems like an issue handling 2 hotkeys at the same time,
until we will figure it out, you can try use

for workaround

Thanks. I’ll look into this api.

I ran into another issue with the hotkeys api.

The above sample project in my original post can be used for testing. I just added another hotkey into the manifest.

Issue:

If two hotkeys are pressed close to the same time, then the first hotkey will fire another onPressed event.

In my testing, pressing hotkeys about 200ms or more apart looked like there is no issue, but under 200ms we have a chance the previous hotkey’s event will be repeated.

My testing showed about 180ms apart is still ok, but about 160ms and below has the event repeating issue.

In the below screenshot, I press the first hotkey “y” then followed by the second hotkey “u”. A third event is fired for the first hotkey I pressed, “y”.
image

The same thing happens when pressing more than two hotkeys. I will get repeats of the previous hotkeys pressed.