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

Option to auto-hide vertical scrollbar #1923

Closed
hethhhhh opened this issue Jun 6, 2018 · 14 comments
Closed

Option to auto-hide vertical scrollbar #1923

hethhhhh opened this issue Jun 6, 2018 · 14 comments

Comments

@hethhhhh
Copy link

hethhhhh commented Jun 6, 2018

Can you please add an option or CSS so that the vertical scrollbar auto-hides (and show it on mouse scroll for example)

Thank you.

@Keith94
Copy link

Keith94 commented Jun 6, 2018

#tabbar.overflow {
  margin-right: -16px;
}
#tabbar:hover {
  margin-right: 0px;
}

@hethhhhh
Copy link
Author

hethhhhh commented Jun 6, 2018

That's great, but the transitions doesn't work :(

@piroor piroor added Firefox-issue bug of Firefox itself has-workaround and removed Firefox-issue bug of Firefox itself labels Jun 8, 2018
@piroor
Copy link
Owner

piroor commented Jun 8, 2018

How about this?

:root.left-scrollbar #tabbar.overflow {
  margin-left: calc(0px - var(--scrollbar-size));
  transition: margin-left ease 0.25s 0.4s;
}
:root.right-scrollbar #tabbar.overflow {
  margin-right: calc(0px - var(--scrollbar-size));
  transition: margin-right ease 0.25s 0.4s;
}

:root.left-scrollbar #tabbar.overflow:hover {
  margin-left: 0;
}
:root.right-scrollbar #tabbar.overflow:hover {
  margin-right: 0;
}

:root.left-scrollbar.narrow-scrollbar #tabbar.overflow:hover {
  margin-left: calc(var(--narrow-scrollbar-size) - var(--scrollbar-size));
}
:root.right-scrollbar.narrow-scrollbar #tabbar.overflow:hover {
  margin-right: calc(var(--narrow-scrollbar-size) - var(--scrollbar-size));
}

@hethhhhh
Copy link
Author

hethhhhh commented Jun 8, 2018

this one doesn't hide it at all

@piroor
Copy link
Owner

piroor commented Jun 9, 2018

How it broken? It works on my environment as expected so I cannot imagine how I should "fix" it. Could you attach screenshots?

@hethhhhh
Copy link
Author

I cleaned up some code in the Extra style rules and now it works! Probably something left over like a bracket.
Thanks a lot!

@piroor
Copy link
Owner

piroor commented Jun 10, 2018

@nh2
Copy link
Contributor

nh2 commented Dec 1, 2018

For me margin- no longer works.

This works for me, replacing all margin- bits by nothing:

:root.left-scrollbar #tabbar.overflow {
  left: calc(0px - var(--scrollbar-size));
  transition: left ease 0.25s 0.4s;
}
:root.right-scrollbar #tabbar.overflow {
  right: calc(0px - var(--scrollbar-size));
  transition: right ease 0.25s 0.4s;
}

:root.left-scrollbar #tabbar.overflow:hover {
  left: 0;
}
:root.right-scrollbar #tabbar.overflow:hover {
  right: 0;
}

:root.left-scrollbar.narrow-scrollbar #tabbar.overflow:hover {
  left: calc(var(--narrow-scrollbar-size) - var(--scrollbar-size));
}
:root.right-scrollbar.narrow-scrollbar #tabbar.overflow:hover {
  right: calc(var(--narrow-scrollbar-size) - var(--scrollbar-size));
}

@nh2
Copy link
Contributor

nh2 commented Apr 2, 2019

My fix above now no longer works since the most recent update of TST or Firefox; it now makes tab labels invisible: #2200 (comment)

@nh2
Copy link
Contributor

nh2 commented Apr 2, 2019

It looks like the automatic calculation of the offset using var(--scrollbar-size) no longer works.

I've made it work hardcoding some pixels (including only the case where the scrollbar is on the left, as I couldn't make it work with the snippet that puts the bar on the right):

/* Auto hide scrollbar */

:root.left-scrollbar #tabbar.overflow {
  left: -5px; /* calc(0px - var(--scrollbar-size)); */
  transition: left ease 0.25s 0.4s;
}

:root.left-scrollbar #tabbar.overflow:hover {
  margin-left: 0;
}

:root.left-scrollbar.narrow-scrollbar #tabbar.overflow:hover {
  left: 0px; /* calc(var(--narrow-scrollbar-size) - var(--scrollbar-size)); */
}

@piroor
Copy link
Owner

piroor commented Apr 3, 2019

The scrollbar in the sidebar is now controlled with the CSS property scrollbar-width, so I removed custom properties to define the scrollbar size. I've updated code snippets to follow the change:
https://github.com/piroor/treestyletab/wiki/Code-snippets-for-custom-style-rules#auto-hide-scrollbar-1923

@nh2
Copy link
Contributor

nh2 commented Apr 3, 2019

@piroor Thank you, that works well!

@irvinm
Copy link
Contributor

irvinm commented Nov 15, 2019

The scrollbar in the sidebar is now controlled with the CSS property scrollbar-width, so I removed custom properties to define the scrollbar size. I've updated code snippets to follow the change:
https://github.com/piroor/treestyletab/wiki/Code-snippets-for-custom-style-rules#auto-hide-scrollbar-1923

Can anyone still confirm this snippet still works? (Obviously the 3.0.5+ version) I was reviewing my TST CSS and saw that I had it in there, but my scrollbar was always being displayed. (FF 70.0.1 \ TST 3.2.5)

@irvinm
Copy link
Contributor

irvinm commented Nov 16, 2019

For my situation, I found a simplified solution that works nicely using the "none", "thin", and "auto" standard values.

/* hide scrollbar until hovering over tabs */
#tabbar.overflow { scrollbar-width: none; } 
#tabbar.overflow:hover { scrollbar-width: thin; } 

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

No branches or pull requests

5 participants