Suppress context menu upon right click

How do I suppress the context menu when using GameLab?

When I right-click in the game window, GameLab does recognize the right-click, but the Safari and/or Chrome context menu also pops up.

Project: - Game Lab

I tried to fix it this way:

document.addEventListener('contextmenu', event => event.preventDefault());

But, document doesn’t appear to be available in GameLab.

Hi @kurmasz,

I see the issue you’re having. I haven’t been able to figure out how to solve it, but I’ve passed it up the chain & hopefully somebody can get back to you in the next day or two.

–Michael K.

Hey @kurmasz! Sorry to say - you won’t be able to access the document object within Game Lab.

If you’d like to dive deeper into connecting your games to the browser and adding things like events, I’d recommend switching over to p5js and their play library.

Dan - Curriculum Writer

Thanks, Dan. At the moment I don’t have any general desire to access the document. I was just trying to find a way around the right-click issue.