-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Open
Description
Most appropriate sub-area of p5.js?
- Accessibility
- Color
- Core/Environment/Rendering
- Data
- DOM
- Events
- Image
- IO
- Math
- Typography
- Utilities
- p5.strands
- WebGL
- DevOps, Build process, Unit testing
- Internationalization (i18n)
- Friendly Errors
- Other (specify if possible)
p5.js version
1.11.11
Web browser and version
Safari Version 26.0.1 (20622.1.22.118.4).
Operating system
MacOSX
Steps to reproduce this
Likely a bug with Safari/DOM, but worth seeing if something could be resolved from within p5js code. When creating a dropdown DOM with createSelect() function in p5js, it seems that on Safari, interactions with that dropdown are triggering a p5js mousePressed event but not a corresponding p5js mouseReleased event. This leaves internal variable mouseIsPressed set to true, and subsequent mouse move events are being categorized as mouse draw events from within src/events/mouse.js as a result. Problem was reproduced on two machines using MacOSX + Safari, but the problem does not occur when using Chrome or Firefox on those same machines, nor when using Safari on an iPad.
Steps:
- Click on the dropdown widget to make selection
- Release mouse after making selection
- Mouse over the p5js Canvas.
Snippet:
// Demo at https://editor.p5js.org/michaelgoldwasser/sketches/Dbdib65Qp
function setup() {
createCanvas(400, 400);
background(220);
noStroke();
selector = createSelect();
selector.option("red", color(255, 0, 0));
selector.option("blue", color(0, 0, 255));
}
function mousePressed() {
console.log("mousePressed fired");
}
function mouseReleased() {
console.log("mouseReleased fired");
}
function mouseDragged() {
fill(selector.value());
circle(mouseX, mouseY, 5);
}