Skip to content

Reset mouseIsPressed on window blur#8559

Merged
davepagurek merged 3 commits intoprocessing:dev-2.0from
avinxshKD:fix/mouse-blur-reset
Feb 27, 2026
Merged

Reset mouseIsPressed on window blur#8559
davepagurek merged 3 commits intoprocessing:dev-2.0from
avinxshKD:fix/mouse-blur-reset

Conversation

@avinxshKD
Copy link
Contributor

Resolves #8552

mouseIsPressed would stay true if you held a mouse button, alt-tabbed out, released, and came back , pointerup never fires when the window doesn't have focus. Added a blur listener in pointer.js that resets it. 4 lines, same cleanup pattern (_removeSignal) as every other listener in that file.

@avinxshKD
Copy link
Contributor Author

@avinxshKD please feel free to go ahead with work on this one on 2.0. As you said it's similar to the key one in the other issue. I think only one of these should be done initially to get some feedback.

Why I'm a bit cautious: Although the tabbing-away behavior is not intuitive and buggy, its also not a regression (if I understood it well), so I want to be sure that changing the existing behavior doesn't have surprising side-effects. (Eg, in more complex uses, like in P5Live, which might rely on current behavior being stable - this is just a guess, I am not sure if there are side effects) I hope this clarifies why I think it's worth being a bit cautious about this one.

That said, as you write, mouse has no blur handler at all right now, so I think this is a better place to start.

Thanks @ksen0, kept it minimal for exactly that reason. Only resets mouseIsPressed, nothing else. mouseButton is untouched so any code branching on which button was held still sees the same state it did before. The change is 4 lines in pointer.js's presetup ...same { signal: this._removeSignal } cleanup pattern the other listeners there already use, so no new teardown logic needed either.

If there are side effects to watch for, happy to add a note in the PR description calling it out explicitly so reviewers know what to poke at, lmk

Copy link
Contributor

@davepagurek davepagurek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @avinxshKD, this seems like a reasonable fix that doesn't look like it has the potential to break too much. @ksen0 maybe we want to specifically loop in p5live when testing the next RC just to double check?

@davepagurek davepagurek merged commit 8773a49 into processing:dev-2.0 Feb 27, 2026
2 checks passed
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.

2 participants