Skip to content

feat: style scrollbars globally in theme - #228

Draft
tonyco97 wants to merge 1 commit into
mainfrom
feat/global-scrollbar
Draft

tonyco97 wants to merge 1 commit into
mainfrom
feat/global-scrollbar

Conversation

@tonyco97

Copy link
Copy Markdown

Scrollbars had no style in the library, so every product shows the system ones, and NethVoice CTI styles them with tailwind-scrollbar classes repeated on each scrolling element.

The theme now styles every scrollbar, with no class to add: a thin scrollbar with a gray-400 thumb and a gray-200 track (gray-900 in the dark theme), the same colors that NethVoice CTI uses.

  • Chromium and WebKit browsers use ::-webkit-scrollbar (8px, rounded thumb).
  • Firefox uses scrollbar-width: thin and scrollbar-color, only inside @supports (-moz-appearance: none): since Chrome 121, an element with scrollbar-width or scrollbar-color ignores ::-webkit-scrollbar.
  • The track and the corner are not rounded: rounded ends showed the background under the scrollbar, white on the page scrollbar when html has no background.
  • The rules are in @layer base and use :where(), so a product overrides them with any class, such as [scrollbar-width:none] to hide a scrollbar.

This changes the look of every product that imports the theme.

Tested

In the playground, in the light and the dark theme: a vertical list, a table that scrolls in both directions, the NeCombobox dropdown, a textarea, the page scrollbars, and a box that hides its scrollbar. Every pixel of each scrollbar was compared with the token colors:

  • Chrome 155, Brave 155, Firefox 158 and WebKit on Linux: OK.
  • Firefox 158 page scrollbars were checked on the Playwright Firefox build only, since Firefox headless screenshots leave them out.

Not tested: Safari on macOS, Windows, Android, forced colors mode.

npm run lint, npm run format, npm run build and npm run build-storybook pass.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant