Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/sweet-chicken-stay.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@liam-hq/ui": patch
---

- 💄 fix scrollbar styles so that ::-webkit-scrollbar pseudo classes take effect in Safari
43 changes: 25 additions & 18 deletions frontend/packages/ui/src/styles/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,34 @@
@import './syntax-highlight.css';

/* Global scrollbar styling for all scrollable elements */
* {
scrollbar-color: var(--scrollbar-thumb-background)
var(--scrollbar-track-background);
scrollbar-width: var(--scrollbar-width);
}

/* WebKit scrollbar styling */
*::-webkit-scrollbar {
width: var(--scrollbar-webkit-width);
height: var(--scrollbar-webkit-height);
/* For browsers that support `scrollbar-*` properties */
@supports (scrollbar-color: auto) {
Comment on lines +11 to +12
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I recommend to check the diff with by hiding white spaces

I basically follow this instruction.
Since the latest Safari (v26) supports scrollbar-width property, it prioritize the standard scrollbar styles when scrollbar-width has value other than auto and doesn't refer to -webkit-scrollbar-* pseuds classes. However, it doesn't support the scrollbar-color property yet, so scrollbars used to be displayed with the default color in Safari.

This PR will make the scrollbar-width property declaration be not applied in the Safari, so webkit-scrollbar-* pseud classes will be applied properly.

* {
scrollbar-color: var(--scrollbar-thumb-background)
var(--scrollbar-track-background);
scrollbar-width: var(--scrollbar-width);
}
}

*::-webkit-scrollbar-track {
background: var(--scrollbar-track-background);
}
/* Otherwise, use `::-webkit-scrollbar-*` pseudo-elements */
/* If a browser supports both, the `scrollbar-*` properties will take precedence */
@supports selector(::-webkit-scrollbar) {
*::-webkit-scrollbar {
width: var(--scrollbar-webkit-width);
height: var(--scrollbar-webkit-height);
}

*::-webkit-scrollbar-thumb {
background-color: var(--scrollbar-thumb-background);
border-radius: var(--scrollbar-webkit-thumb-border-radius);
}
*::-webkit-scrollbar-track {
background: var(--scrollbar-track-background);
}

*::-webkit-scrollbar-thumb {
background-color: var(--scrollbar-thumb-background);
border-radius: var(--scrollbar-webkit-thumb-border-radius);
}

*::-webkit-scrollbar-thumb:hover {
background-color: var(--scrollbar-thumb-background-hover);
*::-webkit-scrollbar-thumb:hover {
background-color: var(--scrollbar-thumb-background-hover);
}
}