Question

I've configured Pointer Events through pointerevents-polyfill.

There's an issue I have where I cannot differentiate between left- and right-clicks where right-clicking a nav item will do the same action as left-clicking instead of opening the right-click menu.

The specific event I'm using is pointerup.

Is there a way with Pointer Events to check if the event is a left- or right-click?

Was it helpful?

Solution 2

I used event.type == 'click' (left) vs. event.type == 'contextmenu' (right).

OTHER TIPS

Looks like there is a property called button that has a value of 0 if it's the primary pointer (left mouse button).

I haven't used this library but from looking at the source and the W3C spec it would appear that way.

You can always print/debug the event and see what the property is.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top