Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scrollbars and other draggable elements get stuck mouse leaves browser window #4406

Closed
DrSloth opened this issue Apr 25, 2024 · 2 comments · Fixed by #4419
Closed

Scrollbars and other draggable elements get stuck mouse leaves browser window #4406

DrSloth opened this issue Apr 25, 2024 · 2 comments · Fixed by #4419
Labels
bug Something is broken

Comments

@DrSloth
Copy link

DrSloth commented Apr 25, 2024

Describe the bug

This bug is exclusive to wasm.
When dragging a scroll bar and then leaving the browser window with the mouse makes the scrollbar "stuck". It will only be unstuck by clicking into the browser window again, until you click again there will also be no hover effects or any other interaction.

I was able to observe and consistently product this bug on both windows and debian linux.

To Reproduce
Steps to reproduce the behavior:

  1. Open egui.rs
  2. Open any window with scrolling, for instance the scrolling demo window
  3. Click and hold the scroll handle
  4. Move your mouse outside the browser window without releasing the mouse button
  5. Try to interact with anything else
  6. After clicking the scrollbar will jump

Expected behavior

I would expect the scroll bar to treat the mouse leaving the window as releasing the mouse button.

Desktop (please complete the following information):
I tested this on both Debian and Ubuntu Linux as well as Windows in Firefox, Chromium and Chrome, the behavior was the same in every browser.
The problem seems to be exclusive to wasm.

Additional context

When given pointers i would definitely be willing to track down the cause of the problem. It seems to be quite deep as other draggables such as sliders inhibit similar but not as disrupting problems

Thanks for all your hard work and have a great day ::)

@DrSloth DrSloth added the bug Something is broken label Apr 25, 2024
@rustbasic
Copy link
Contributor

Perhaps in the current egui, scrolling is only allowed when the mouse pointer is hovering over it.

This is related, right?

@DrSloth
Copy link
Author

DrSloth commented Apr 25, 2024

Maybe. Currently i definitely can scroll when not hovering the scrollbar. I can only start scrolling when i hover it but i can keep scrolling when my leaves it.

emilk pushed a commit that referenced this issue May 11, 2024
* Closes #4406
* Closes #4418 

If `Event::PointerGone` occurs, it is treated as
`PointerEvent::Released`.
emilk added a commit that referenced this issue May 22, 2024
* Closes #3157

If the mouse leaves the canvas when dragging a slider, the slider will
still move.

---

To support this, I had to revert #4419
Despite that, I fail to reproduce the two issues it claimed to solve:

* #4406 may have been solved in
another way by this PR
* #4418 I cannot reproduce on Mac.
If it is still a problem, I think it should be solved by triggering a
`PointerEvent::Released` when focus is lost (i.e. on alt-tab), and not
on `PointerGone`
hacknus pushed a commit to hacknus/egui that referenced this issue Oct 30, 2024
* Closes emilk#4406
* Closes emilk#4418 

If `Event::PointerGone` occurs, it is treated as
`PointerEvent::Released`.
hacknus pushed a commit to hacknus/egui that referenced this issue Oct 30, 2024
* Closes emilk#3157

If the mouse leaves the canvas when dragging a slider, the slider will
still move.

---

To support this, I had to revert emilk#4419
Despite that, I fail to reproduce the two issues it claimed to solve:

* emilk#4406 may have been solved in
another way by this PR
* emilk#4418 I cannot reproduce on Mac.
If it is still a problem, I think it should be solved by triggering a
`PointerEvent::Released` when focus is lost (i.e. on alt-tab), and not
on `PointerGone`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is broken
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants