Skip to content

scrollbar: improve visibility animation - #2737

Draft
huacnlee wants to merge 13 commits into
mainfrom
scrollbar-visibility-animation
Draft

scrollbar: improve visibility animation#2737
huacnlee wants to merge 13 commits into
mainfrom
scrollbar-visibility-animation

Conversation

@huacnlee

Copy link
Copy Markdown
Member

Description

Improve scrollbar appearance and disappearance motion across the shared gpui-base implementation.

  • slide vertical scrollbars in from the right and horizontal scrollbars up from the bottom
  • use a visible 300 ms linear fade-in with eased position, followed by the existing 2-second hold
  • slide and fade out over 500 ms with cubic ease-in
  • reverse interrupted animations from their current opacity and position
  • keep layout and hitboxes stationary, disable hidden track/thumb interactions, and respect reduced motion
  • preserve the full idle hold after hover and only end active thumb drags

This implementation was AI-assisted, then reviewed, visually tested in the Scrollbar story, and covered with test-first regression tests.

Screenshot

The change is temporal rather than a static layout change. It was manually exercised in the Scrollbar story across Scrolling, Hover, and Always modes.

How to Test

cargo fmt --all -- --check
cargo test -p gpui-base
cargo run -p gpui-component-story -- Scrollbar

In the story, switch between Scrolling, Hover, and Always and verify the entrance/exit directions, visible fade, interruption reversal, and stationary Always behavior.

Checklist

  • I have read the CONTRIBUTING document and followed the guidelines.
  • Reviewed the changes in this PR and confirmed AI generated code is accurate.
  • Passed cargo run for story tests related to the changes.
  • Tested macOS, Windows and Linux platforms performance (not platform-specific; manually tested on Linux).

@huacnlee
huacnlee marked this pull request as ready for review August 16, 2026 09:44
@huacnlee
huacnlee marked this pull request as draft August 16, 2026 10:00
Base played the scrollbar entrance and exit with its own hardcoded
durations, curves, and per-mode choreography, which put product motion
below the gpui-base seam.

Base now plays a transition it does not own. ScrollbarMotion carries the
idle hold, enter, exit, and expand durations plus a ScrollbarEntrance
choreography, and defaults to motionless: an unstyled scrollbar appears
and disappears with no fade or slide. crates/ui projects the product
timing through ScrollbarTheme::motion, on the full theme projection and
on set_scrollbar_mode alike, so a runtime mode change cannot leave a
stale entrance behind.

A zero duration is now the only way to say "adopt the target now", which
also covers reduced motion and always-visible scrollbars. That replaces
the separate immediate flag, and settles a transition that was already in
flight when the policy changed — the flag used to let it run on, because
set_visible returned early on an unchanged target.

Rendered behavior under the styled theme is unchanged.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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