Skip to content

Extract scrollbar styles to global stylesheet#1398

Open
klagrida wants to merge 4 commits intomainfrom
claude/style-scrollbar-hover-bCTuU
Open

Extract scrollbar styles to global stylesheet#1398
klagrida wants to merge 4 commits intomainfrom
claude/style-scrollbar-hover-bCTuU

Conversation

@klagrida
Copy link
Collaborator

Summary

Refactored scrollbar styling by extracting component-specific styles from the ScrollAreaComponent into a global stylesheet, improving maintainability and enabling consistent scrollbar styling across the application.

Key Changes

  • Created new libs/ui/src/lib/styles/scrollbar.css with global scrollbar styling rules
    • Applies to all elements using CSS @layer base
    • Defines thin scrollbar width with transparent default state
    • Shows border color on hover for both Firefox and WebKit browsers
    • Supports both standard scrollbar-* properties and -webkit-scrollbar pseudo-elements
  • Removed inline scrollbar styles from ScrollAreaComponent template
  • Added import of new scrollbar stylesheet to libs/ui/src/lib/styles/index.css

Implementation Details

  • Used CSS @layer base to ensure scrollbar styles apply at the base layer without specificity conflicts
  • Maintained cross-browser compatibility with both standard and vendor-prefixed scrollbar properties
  • Scrollbar remains hidden by default and only appears on hover, providing a cleaner UI
  • Global approach allows scrollbar styling to apply consistently across all scrollable elements, not just scroll-area components

https://claude.ai/code/session_016Q1ACxFMzDYBu3t7oKN8Ap

Create a dedicated scrollbar.css that applies thin, transparent-by-default
scrollbars across the app with a hover reveal effect. Remove the now-redundant
scrollbar styles from the scroll-area component.

https://claude.ai/code/session_016Q1ACxFMzDYBu3t7oKN8Ap
Global scrollbars now show thin thumbs by default. The transparent-to-visible
hover reveal is scoped to [data-slot='scroll-area'] elements only.

https://claude.ai/code/session_016Q1ACxFMzDYBu3t7oKN8Ap
The scroll-area component now accepts a `show` input that controls
scrollbar visibility. Defaults to 'onhover' (transparent until hover).
Set to 'always' to keep the scrollbar visible at all times.

https://claude.ai/code/session_016Q1ACxFMzDYBu3t7oKN8Ap
The input is unnecessary — if you want always-visible scrollbars, just
use a plain div with overflow-auto (the global default). Scroll area's
purpose is the hover reveal behavior.

https://claude.ai/code/session_016Q1ACxFMzDYBu3t7oKN8Ap
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.

2 participants