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

Setting ScrollViewer's VerticalScrollBarVisibility to Visible does not produce implied effect #6703

Closed
1 of 2 tasks
marwalsch opened this issue Feb 11, 2022 · 8 comments
Closed
1 of 2 tasks
Labels

Comments

@marwalsch
Copy link

Describe the bug

When a ScrollViewer's VerticalScrollBarVisibility is set to Visible, it apparently behaves in the exact same manner as in Auto state:

  • The Scrollbar is visible when the content is actually scrollable;
  • the scrollbar disappears in the opposite case.

However, in compliance with the enum's corresponding value the scrollbar should always be present, even in the latter case (and reach its full width).

Even though I have the suspicion this is by design the API implicates otherwise.

Steps to reproduce the bug

  • Set a ScrollViewer's VerticalScrollBarVisibility to Auto/Visible;
  • Observe how the bar disappears when content is not actually scrollable (just like in auto mode).

Expected behavior

Setting VerticalScrollBarVisibility to Visible should always display the bar.

Screenshots

image

image

NuGet package version

No response

Windows app type

  • UWP
  • Win32

Device form factor

Desktop

Windows version

Insider Build (xxxxx)

Additional context

No response

@ghost ghost added the needs-triage Issue needs to be triaged by the area owners label Feb 11, 2022
@kmgallahan
Copy link
Contributor

kmgallahan commented Feb 11, 2022

The ScrollViewer's vertical ScrollBar container's visibility is bound here and set here.

Unsure where the problem is from there.

@StephenLPeters
Copy link
Contributor

Confusingly, what you've linked to the ScrollView code (a winui2 control) where as the ScrollViewer (a system xaml control) is the control in question. ScrollViewer's scrollbar integration is a little wonky, and is one of the things that was fixed in ScrollView. @RBrid correct me if i'm wrong, it is by design that the auto and visible behave the same here. I think there are some differences between the enum values though... do you know what they are?

@StephenLPeters StephenLPeters added area-ScrollBar area-Scrolling team-Controls Issue for the Controls team and removed needs-triage Issue needs to be triaged by the area owners labels Mar 4, 2022
@RBrid
Copy link
Contributor

RBrid commented Mar 5, 2022

It seems to work for me as expected: even when using ScrollBarVisibility.Visible, the user needs to hover over the scrollbar area for a couple seconds before it appears.

@kmgallahan
Copy link
Contributor

@RBrid I believe the issue was created because the OP wants the scrollbar to always be visible, even if no scrolling can be performed. That would be the differentiation between using Auto and Visible.

Observe how the bar disappears when content is not actually scrollable (just like in auto mode).

@marwalsch
Copy link
Author

Thanks for following up.

@RBrid
@kmgallahan is right. I would argue that ScrollBarVisibility.Visible still requiring a hover to have it appear at all might be a good fit as long as ScrollBarVisibility.Auto exists. I noticed as well that even when hovering it in a ScrollViewer not being overflown, the arrows appear, but the actual bar does not (which I'd expect to at full length at this point).
Are there any difference between these two values at all?

@RBrid
Copy link
Contributor

RBrid commented Mar 7, 2022

Greetings.
For the vertical ScrollBar, the difference between ScrollBarVisibility.Auto and ScrollBarVisibility.Visible occurs when ScrollViewer.ScrollableHeight is 0.

When ScrollViewer.ScrollableHeight > 0, ScrollBarVisibility.Auto acts like ScrollBarVisibility.Visible.
When ScrollViewer.ScrollableHeight = 0, ScrollBarVisibility.Auto acts like ScrollBarVisibility.Hidden.

When ScrollViewer.ScrollableHeight = 0 and ScrollViewer.VerticalScrollBarVisibility = Visible, the ScrollBar track and arrows appear on mouse hover. Its Thumb does not appear because there is nothing to scroll:

image

The mouse hovering is needed because by default ScrollBars are in what we call 'conscious/shy' mode. The user can turn off that shy mode by selecting the "Always show scrollbars" option in the Settings app:

image

At that point, ScrollBarVisibility.Visible causes the ScrollBar to always be visible. Same for ScrollBarVisibility.Auto when ScrollViewer.ScrollableHeight > 0 (or ScrollViewer.ScrollableWidth > 0).

Hope this helps. Thanks.

@marwalsch
Copy link
Author

@RBrid
Thanks, I wasn't aware of the windows-wide scrollbar setting, now it makes more sense. I assume there is no way to activate this setting on application scope regardless of the Windows setting, the same way we can force a specific theme on application root?

@RBrid
Copy link
Contributor

RBrid commented Mar 8, 2022

You're correct @marwalsch, there is no application-level setting for that behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants