From b1935b95a1cb748ba002015c9b59cf64228ca131 Mon Sep 17 00:00:00 2001 From: Finn Evers Date: Wed, 29 Oct 2025 13:20:57 +0100 Subject: [PATCH] ui: Don't show scrollbar track in too many cases (#41455) Follow-up to https://github.com/zed-industries/zed/pull/41354 which introduced a small regression. Release Notes: - N/A --- crates/ui/src/components/scrollbar.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/crates/ui/src/components/scrollbar.rs b/crates/ui/src/components/scrollbar.rs index eb1d210280872a8b1606439c04c1f67954e50373..d3d33a296bbd65edb24371d8f5f1e6462e77e3fe 100644 --- a/crates/ui/src/components/scrollbar.rs +++ b/crates/ui/src/components/scrollbar.rs @@ -1171,12 +1171,14 @@ impl Element for ScrollbarElement { .apply_along(axis, |_| thumb_end - thumb_offset), ); + let needs_scroll_track = reserved_space.needs_scroll_track(); + ScrollbarLayout { thumb_bounds, track_bounds: padded_bounds, axis, cursor_hitbox: window.insert_hitbox( - if reserved_space.needs_scroll_track() { + if needs_scroll_track { padded_bounds } else { thumb_bounds @@ -1184,6 +1186,7 @@ impl Element for ScrollbarElement { HitboxBehavior::BlockMouseExceptScroll, ), track_background: track_color + .filter(|_| needs_scroll_track) .map(|color| (padded_bounds.dilate(SCROLLBAR_PADDING), color)), reserved_space, } @@ -1292,10 +1295,15 @@ impl Element for ScrollbarElement { } if let Some((track_bounds, color)) = track_background { + let mut color = *color; + if let Some(fade) = autohide_fade { + color.fade_out(fade); + } + window.paint_quad(quad( *track_bounds, Corners::default(), - *color, + color, Edges::default(), Hsla::transparent_black(), BorderStyle::default(),