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

hasHorizontalScroller = NO; ignored if autohidesScrollers = YES; #236

Open
optimisme opened this issue Dec 31, 2023 · 2 comments
Open

hasHorizontalScroller = NO; ignored if autohidesScrollers = YES; #236

optimisme opened this issue Dec 31, 2023 · 2 comments

Comments

@optimisme
Copy link

When 'autohidesScrollers = YES;' the horizontal scroll is shown even if 'hasHorizontalScroller = NO;'

@fredkiefer
Copy link
Member

It would really help, if somebody could detail the behaviour of these settings on macOS and more specifically on different versions of macOS. How do these two values (plus verticalScroller) relate to each other, when an NSScrollView gets resized?
With autohidesScrollers being NO, things should be easy the scrollers get controlled manually. But with that value being YES things might get complicated. Our expectation is that this not only hides scrollers but also displays them when needed.
If you read through the documentation by Apple you will see that they are rather unspecific on what happens.

@optimisme
Copy link
Author

The behavior of macOS is complex, and it depends on whether a magic mouse or a trackpad is available, or if only a traditional mouse is being used.

If only a traditional mouse is available, the scroll bars are displayed if they are configured and necessary:

In this example (ScrollBar-Mouse00), only the vertical bar is visible with this configuration:

hasVerticalScroller = YES;
hasHorizontalScroller = NO;
autohidesScrollers = YES;
ScrollBar-Mouse00

In this example (ScrollBar-Mouse01), both are shown, with this configuration because the horizontal is necessary:

hasVerticalScroller = YES;
hasHorizontalScroller = YES;
autohidesScrollers = YES;
ScrollBar-Mouse01

However, with the same configuration, when the horizontal is not necessary, it is not displayed (ScrollBar-Mouse02):

hasVerticalScroller = YES;
hasHorizontalScroller = YES;
autohidesScrollers = YES;
ScrollBar-Mouse02

When the value of autohidesScrollers is changed to NO, the space for the bar is still drawn, but the scrollbar is only visible if necessary (ScrollBar-Mouse03):

self.hasVerticalScroller = YES;
self.hasHorizontalScroller = YES;
self.autohidesScrollers = NO;
ScrollBar-Mouse03

However, the above configurations are not very common, as most users have a trackpad or a magic mouse. In that case, the scroll bars behave like this:

autohidesScrollers seems not to affect the behavior or the display, the bars always automatically hide and are shown when dragging the content or changing the size of the available space (usually when resizing the window)

even if the bars are configured with hasVerticalScroller/hasHorizontalScroller to NO, the scrolls are not drawn but the content can be moved with the trackpad as if they were active. (ScrollBar-Trackpad04):

self.hasVerticalScroller = NO;
self.hasHorizontalScroller = NO;
self.autohidesScrollers = NO;
ScrollBar-Trackpad04.mov

Leaving NO to the vertical scroll, or horizontal the behavior is the same as the previous one, but the scroll configured as visible is drawn, and also, you can interact with the mouse and the trackpad. (ScrollBar-Trackpad05):

self.hasVerticalScroller = YES;
self.hasHorizontalScroller = NO;
self.autohidesScrollers = NO;
ScrollBar-Trackpad05.mov

The next example shows the behavior when resizing the available space (ScrollBar-Trackpad06):

self.hasVerticalScroller = YES;
self.hasHorizontalScroller = YES;
self.autohidesScrollers = NO;
ScrollBar-Trackpad06.mov

It is important to note, that in the case of the trackpad/magic-mouse there are two visualizations, the one that shows only the scroll bar which is thinner and has a transparent background and the one that is shown while interacting which is thicker and shows the background bar as when only a traditional mouse is available (ScrollBar-Trackpad07)

ScrollBar-Trackpad07.mov

Finally, remember that all these configurations, it seems that they are only possible with the implementation of Layers and CoreAnimation.

Perhaps it would be fantastic to have a theme configuration, type:

NSScrollViewInterfaceStyle = NSWindows95InterfaceStyle;
NSScrollerInterfaceStyle = NSWindows95InterfaceStyle;

But adapted to the behaviors and captures described above, something like:

NSScrollViewInterfaceStyle = NSMacOSInterfaceStyle;
NSScrollerInterfaceStyle = NSMacOSInterfaceStyle;

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

No branches or pull requests

2 participants