processing / p5.js-web-editor

The p5.js Editor is a website for creating p5.js sketches, with a focus on making coding accessible and inclusive for artists, designers, educators, beginners, and anyone else! You can create, share, or remix p5.js sketches without needing to download or configure anything.
https://editor.p5js.org
GNU Lesser General Public License v2.1
1.37k stars 1.32k forks source link

keyTyped does not work in conjunction with returning false in mousePressed #3139

Open BenMaydan opened 4 years ago

BenMaydan commented 4 years ago

Most appropriate sub-area of p5.js?

Details about the bug:

function setup() { createCanvas(400, 400); }

function draw() { background(220); }

function mousePressed() { return false; }

function keyPressed() { print(key); }

welcome[bot] commented 4 years ago

Welcome! 👋 Thanks for opening your first issue here! And to ensure the community is able to respond to your issue, be sure to follow the issue template if you haven't already.

pcgamer1 commented 4 years ago

I would like to work on this. Seems like an issue with an EventListener.

limzykenneth commented 4 years ago

@BenMaydan I'm not able to replicate this locally, can this be a web editor bug?

micuat commented 4 years ago

with return false it triggers e.preventDefault(). my guess is that after the click, the iframe in web editor does not capture the cursor even if you click, and thus doesn't catch key events. If you click on the editor console and hit tab a few times to select iframe, key events are fired properly

kllsamui commented 4 years ago

sounds right, @micuat see the same https://editor.p5js.org/kll/sketches/tLtOxsq78 here.

Dainess commented 2 years ago

I'd like to point out as of April 2022 I fould the same problem as OP, when I call return false on mousePressed() it breaks the code in keyPressed()

limzykenneth commented 2 years ago

This issue only happens in the web editor, please file this bug over here instead. Thanks.

welcome[bot] commented 4 months ago

Welcome! 👋 Thanks for opening your first issue here! And to ensure the community is able to respond to your issue, be sure to follow the issue template if you haven't already.