Phaser Version:
v3.12.0-beta2
Operating system:
macOS HighSierra
10.13.6
Browser:
Google Chrome: Version 68.0.3440.106 (Official Build) (64-bit)
This is browser specific, in Safari and Firefox works fine.
When a cursor key is down enter to the conditional but when is released never return to the original state. In this case keep printing 'Is down' forever.
if (cursors.left.isDown) {
console.log('Is down');
}
You can replicate the behavior on the Cursor Keys example: http://labs.phaser.io/view.html?src=src/input/keyboard/cursor%20keys.js
Works fine for me. It'd be strange if this was an OSX thing, but I wouldn't rule it out.
A pretty critical thing for a browser to get wrong though!
I'm running:
Works fine for me on OS X. Are you sure this isn't a keyboard combo hardware limitation? I.e. the way lots of keyboards can't handle you pressing the right arrow + space bar at the same time because of the way they're built? (the contact strips beneath them), or a Chrome extension getting in the way?
I was using the built-in keyboard (MacBook Pro 2017).
I have tried with an USB keyboard and I have had the same problem.
Ok, now I have tried disabling one by one my chrome extensions and was that, problem solved.
Was the "Evernote Web Clipper" extension.
Thanks for your help.
I can confirm that "Evernote Web Clipper" was casuign this issue for me as well. Anyone has an explanation of how this is possible? This could be a serious issue as so many people use this extension. Thank you @colormono for posting this solution
Try https://w3c.github.io/uievents/tools/key-event-viewer.html with Web Clipper on/off.
anyone figure out a way to get this working without having to uninstall the Evernote Web Clipper? I use this extension all the time and I'd imagine I'm not alone.
+1 for @crazedVic proposal. It took me hours to find this issue. Especially because isDown is working in the phaser.io examples but not in my development.
@marthoff there is no known way to prevent this. Evernote Web Clipper basically steals all keyboard input for itself. Perhaps email them and ask? There's nothing we can do about it from our end.
Thanks for your quick reply. I understand the problem is at Evernote. Anyhow I was wondering why the offical examples work and not the demo case given in the first post here. The difference is the iframe: So one workaround is to use an iframe to show the game instead of a div.
That's a bit of an extreme workaround imho. It _may_ be possible to detect if Evernote is installed and running (although I don't know how) and then disable it that way.
For me it's ok for now. I found no way to detect if the extension is installed.
Anyhow, I found this discussion: https://discussion.evernote.com/forums/topic/114013-web-clipper-chrome-extension-steals-javascript-keyup-events/
Maybe it is useful for you to listen on document instead of window.
Most helpful comment
Ok, now I have tried disabling one by one my chrome extensions and was that, problem solved.
Was the "Evernote Web Clipper" extension.
Thanks for your help.