processing / processing/p5.js

mouseIsPressed gets stuck on true

Open
#5,524 4 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Area:Events Bug
Dominant language
JavaScript
Stars
24k
Forks
3.8k
Avg merge
3d 16h
Merged PRs (30d)
25

Description

mouseIsPressed gets stuck on true.

Heres a code example here: https://editor.p5js.org/Jstodd/sketches/1voaDYszt

Try clicking on the screen. After the alert pops up (also happens with console in some cases) mouseIsPressed will be stuck on true.

If you hover your mouse over a button youve created, its going to set it off. This is bad for UX and security. it is also not expected behavior.

Quick fix: Im able to fix it for myself, by setting mouseIsPressed = false in my looped code, that way it force resets it to false every frame.

Image of bug: mouseIsPressedBug

I am using Ubunto 20.04 LTS Linux, and Brave Browser (Version 1.33.106 Chromium: 96.0.4664.110 (Official Build) (64-bit))

My browser settings are normal, no strict mode or anything. And generally Brave should run smooth like Chrome because its chromium based and kept up-to-date.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the reproduction sketch at https://editor.p5js.org/Jstodd/sketches/1voaDYszt and observe mouseIsPressed after the alert or console interaction, including hovering over a created button. Trace the mouse input handling and confirm the fix by checking that mouseIsPressed returns to false after the interaction rather than remaining true.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.