Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable right click #72

Merged
merged 3 commits into from
Feb 23, 2019

Conversation

jasehackman
Copy link
Contributor

This is to resolve ticket #70

I grabbed two ids for the game and disabled the context menu. I'm not sure if this is the best way to handle this. If not, if you can steer me in the right direction and I'll try to resolve it.

@mwcz
Copy link
Member

mwcz commented Feb 17, 2019

Awesome, thanks @jasehackman! What you wrote looks good to me. I think it should work with a single event listener on the window object window.addEventListener("contextmenu", ev => ev.preventDefault()), feel free to try that if you like, but if you don't have the time I'm totally happy to accept this PR as-is. :D

@jasehackman
Copy link
Contributor Author

Give me a few minutes to give that a shot and I'll update the pr.

@jasehackman
Copy link
Contributor Author

I switched the event listener to the window.

In messing around with this I found a bug that if you click around the screen a lot you can move the cursor away from where it is supposed to be typing. You can do this at the menu where you have to type PLAY and in the game.

You can do this with or without having the "contextmenu" disabled but it is easier to do with it disabled.

@mwcz
Copy link
Member

mwcz commented Feb 18, 2019

Interesting, good find! I have some code to put focus back on the hidden <textarea> any time you click somewhere else. It must be failing under some conditions.

I can open an issue for that tomorrow, unless you get to it first!

@jasehackman
Copy link
Contributor Author

Is there anything else that is needed for this PR? I made an issue for the bug described above.

@Jared-Sprague
Copy link
Member

Looks good thanks!

@Jared-Sprague Jared-Sprague merged commit 3bc2a61 into CommandLineHeroes:master Feb 23, 2019
@jasehackman jasehackman deleted the jh-rightClickFix branch February 23, 2019 20:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants