Electron + touch screen doesn't recognize some touch events (randomly)

I’m running an app based on https://github.com/balena-io/balena-electronjs. I’m using the Raspberry Pi 7" touch screen as the display.

My problem is that the touch screen / touch events are sometimes unresponsive and don’t register any presses. If I use a regular mouse, I can’t reproduce this behaviour, everything works and everything is as responsive as intended.

Sometimes the touch screen doesn’t react at all to presses, sometimes it seems to register a new press on the last registered button, even if I’m pressing a completely different button. This behaviour is not consistent, however, so I can’t pinpoint the root cause.

The behaviour seems to start after a bit of idling, but I’m not sure about this. After I manage to get one successful press, everything works fine for a while.

The screen seems to be slightly more responsive when the cursor is visible (i.e. removing the -nocursor flag from start.sh script), but I might be imagining…

I haven’t yet experimented much with other settings such as enabling hw acceleration or increasing gpu memory, but since the external mouse works, I don’t think the problem lies there (I could be wrong…)

Any hints/tips/pointers on how I should start debugging this?

Hi, I found an issue in electron github repo describing similar behavior. Can you try the workaround?

Hi, thanks for the tip (sorry for the lag in replying, was tied up with other work). I tried the workaround and it seems to work nicely.

I’ll do some more testing just in case, but this can be considered solved. Thanks!