Trackpad pinch causes `wheel` JS event with `ctrlKey` true, how to tell if the user is holding Ctrl?

1k Views Asked by At

As described in this question, the browser fires a wheel event with the ctrlKey property set to true when using a multitouch pinch gesture with a laptop trackpad (not a touch screen).

I need to detect when this happens versus when the user is actually scrolling while holding down the Control key so my code can handle them separately. Since the state of ctrlKey is "lying", is there another way to distinguish between the two situations?

The only thing that comes to mind is tracking the up and down state of the Control key within the web page, but that is prone to getting stuck in the wrong state if the up or down events occur outside the focused browser window.

0

There are 0 best solutions below