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

[BUG] scroll bar in the default style is blocking the code block in Windows 10 #1260

Closed
CXwudi opened this issue May 6, 2024 · 6 comments · Fixed by #1261
Closed

[BUG] scroll bar in the default style is blocking the code block in Windows 10 #1260

CXwudi opened this issue May 6, 2024 · 6 comments · Fixed by #1261
Labels
bug Something isn't working

Comments

@CXwudi
Copy link
Contributor

CXwudi commented May 6, 2024

Describe the bug 描述你遇到的错误

Since 6d8755d, the scroll bar in default style in Windows 10 is actually blocking the lower part of the code block.
image

Before the code block reworking from #1225, this was rendered as:
image

Expected behavior 期待的行为

Maybe the CSS needs to be adjusted to reserve some space for the scroll bar, and the amount of space should automatically be correctly determined by the rendering engine (so that no matter how thick is the scroll bar in the default style, the engine should always get it right.)

Screenshots 屏幕截图

See above

Build Environment 构建环境

  • OS: Debian 12 from devcontainer
  • Theme: 693e8f5
  • Hugo: v0.124.1 Extend

Preview Environment 预览环境

  • OS: Windows 10 Pro
  • Browser: Brave Version 1.64.113 Chromium: 123.0.6312.86

Additional Information 补充信息

I guess it is just a small bug from 6d8755d

@CXwudi CXwudi added the bug Something isn't working label May 6, 2024
@HEIGE-PCloud
Copy link
Owner

I removed the old style because on macOS, you get a nice overlay scrollbar that does not shift the layout and hides automatically by default. Also ::-webkit-scrollbar is non-standard and does not work on Firefox anyway.

I don't have a Windows device right now, can you test whether https://developer.mozilla.org/en-US/docs/Web/CSS/scrollbar-gutter would help?

@CXwudi
Copy link
Contributor Author

CXwudi commented May 7, 2024

Unfortunately, scrollbar-gutter: stable; doesn't really work well. I personally prefer scrollbar-width: thin;, but not sure how it looks like on macOS.

This is what scrollbar-width: thin; looks like in Windows Chrome:
image

This is without (current state):
image

This is scrollbar-gutter: stable;, pretty much no changes:
image

I also noticed that there are quite a lot of tailwind CSS, maybe should we try https://www.npmjs.com/package/tailwind-scrollbar

@kkbt0
Copy link
Contributor

kkbt0 commented May 7, 2024

Another interesting thing about the offset caused by the scrollbar is that the scrollbar causes the head bar position to change. This can be seen when switching pages. Because 100% is not equal to 100vw when there is a scrollbar.
GitHub also has this phenomenon.

@HEIGE-PCloud
Copy link
Owner

HEIGE-PCloud commented May 7, 2024

scrollbar-width: thin; seems to be a reasonable solution. In the worst case scenario we can always just add some margin-bottom to the code element.

There is some effort called "fluent scrollbar" to bring an overlay scrollbar to Chrome and Edge on Windows. https://issues.chromium.org/issues/40213017 but there isn't much progress and activity recently.

@HEIGE-PCloud
Copy link
Owner

HEIGE-PCloud commented May 7, 2024

Another interesting thing about the offset caused by the scrollbar is that the scrollbar causes the head bar position to change. This can be seen when switching pages. Because 100% is not equal to 100vw when there is a scrollbar. GitHub also has this phenomenon.

That's one of the reasons why I switched to the native scrollbar, because on macOS, you get an overlay scrollbar https://developer.chrome.com/docs/css-ui/scrollbar-styling#:~:text=Overlay%20scrollbars%20are%20floating%20scrollbars,the%20operating%20system%20to%20decide. that does not eat into the layout and thus avoid problems like this. But apparently it's not easy to get an overlay scrollbar on Windows.

@HEIGE-PCloud HEIGE-PCloud linked a pull request May 7, 2024 that will close this issue
@CXwudi
Copy link
Contributor Author

CXwudi commented May 8, 2024

Apparently, for Windows machines, there are some experimental flags in Chrome based browser where you can enable the macOS-liked scrollbar behaviour
image

This video shows the fluent scrollbar: https://www.youtube.com/watch?v=GdCNvcTu5ZA
image

And this one shows an overlay scrollbar (with fluent scrollbar): https://www.youtube.com/watch?v=3EFHqmHcxhM
image
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants