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

scrollbar: dragging thumb or clicking track do not work before mouse wheel is used once before #685

Closed
sectore opened this issue Mar 4, 2025 · 7 comments · Fixed by #686

Comments

@sectore
Copy link
Contributor

sectore commented Mar 4, 2025

How to reproduce

  1. Run any example with a scrollbar, e.g. cargo run --example list.
  2. Don't scroll by mouse (wheel), but try to click the thumb of the scrollbar to drag it. Or click the track of the scrollbar. No scrolling - nothing happened.
  3. Now scroll by mouse (wheel) once. Then try to click again (similar to step 2). It will work now.

Image

First investigation

Check scrollbar.rs -> is_visible is still false in paint (code), so MouseDownEvent (code from here) can't be handled properly. That's because dragged_axis is still None in is_scrollbar_visible as long as ScrollWheelEvent is not fired once.

Extra info

rustc --version
rustc 1.85.0 (4d91de4e4 2025-02-17)
OS: Ubuntu 24.04.2 LTS x86_64
@huacnlee
Copy link
Member

huacnlee commented Mar 4, 2025

This is by design.

You can see the same behaviors in macOS scrollbar, we only can click scrollbar when it appeared (First scroll wheel will show it.).

If you don't like this, you can use ScrollbarShow::Hover.

@sectore
Copy link
Contributor Author

sectore commented Mar 4, 2025

You can see the same behaviors in macOS scrollbar, we only can click scrollbar when it appeared (First scroll wheel will show it.).

Scrollbar is already there and visible (see screen shot), but no clickable. At least not before mouse wheel is used once.

@sectore
Copy link
Contributor Author

sectore commented Mar 4, 2025

Demo:

  • (left hand side): Trying to click / dragg track of scrollbar. Note: Mouse cursor is not recorded in screen cast for any reason - just ignore that.
  • (right hand side): Some log output to demonstrate is_visible is still false.
demo.mp4

@huacnlee
Copy link
Member

huacnlee commented Mar 4, 2025

Try main branch, it was a bug, the scrollbar will show on hover.

#681

@sectore
Copy link
Contributor Author

sectore commented Mar 4, 2025

Try main branch, it was a bug, the scrollbar will show on hover.

#681

Bug fix was already included in my local branch by merging latest main today, but the issue still exist.

# git log

1feaf72 (HEAD -> main) Merge remote-tracking branch 'upstream/main'
8c4884d (upstream/main, upstream/HEAD) tab: Remove `w_full` from TabBar. (#683)
f8a5302 dock: Fix incorrect extra inner padding in Panels. (#682)
baa9294 Merge remote-tracking branch 'upstream/main'
6c9a317 scrollbar: Fix scroll to show scrollbar. (#681)

@huacnlee
Copy link
Member

huacnlee commented Mar 4, 2025

I make a record for this (on main branch newest code), the click and drag is correct.

CleanShot.2025-03-04.at.21.55.35.mp4

Sorry, I still not understand your problem, as you see on my video (It corrects):

  1. If we do not do mouse wheel, the scrollbar will hide (This is by design), for this time it can't receive any click/drag event, because of it is invisible.
  2. If we scroll wheel first time, the scrollbar will appear, then click/drag will receive events.

@sectore
Copy link
Contributor Author

sectore commented Mar 4, 2025

Sorry, I still not understand your problem, as you see on my video (It corrects):

Thanks for your double check (incl. video). The issue is platform related, check #686 .

huacnlee added a commit that referenced this issue Mar 5, 2025
On `platform` level,
[should_auto_hide_scrollbars()](https://github.com/zed-industries/zed/blob/76a81607deec5b9093237cd3e98506dccc9f9565/crates/gpui/src/platform.rs#L205)
might be `false` for some `platform`s, e.g. for `Linux`.

That's why another check is needed to make scrollbars work properly on
Linux.

Fixes #685

---------

Co-authored-by: Jason Lee <[email protected]>
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 a pull request may close this issue.

2 participants