From 119ef17316ad906db6bca6ae8d0070e70e5e62e0 Mon Sep 17 00:00:00 2001 From: Aaron Ang Date: Wed, 20 May 2026 15:42:50 -0700 Subject: [PATCH] Make Thumb use full-height track hitbox, remove OverlayTrack MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Thumb-only hitboxes (covering just the thumb rectangle) always let clicks on the track area fall through to content underneath. There is no use case for this — the scrollbar strip should always intercept its own clicks. Fold OverlayTrack's behavior directly into Thumb by including it in needs_scroll_track(), then remove the now-redundant OverlayTrack variant and with_overlay_track_along() method. All vertical_scrollbar_for call sites get the correct behavior automatically. Settings and project panel callers are cleaned up: the settings main list reverts to vertical_scrollbar_for, and the now-redundant with_overlay_track_along calls are removed. Co-Authored-By: Claude Sonnet 4.6 --- crates/project_panel/src/project_panel.rs | 14 ++++---------- crates/settings_ui/src/settings_ui.rs | 9 +-------- crates/ui/src/components/scrollbar.rs | 8 +------- 3 files changed, 6 insertions(+), 25 deletions(-) diff --git a/crates/project_panel/src/project_panel.rs b/crates/project_panel/src/project_panel.rs index ce3a9863bb0..aef907ed9f1 100644 --- a/crates/project_panel/src/project_panel.rs +++ b/crates/project_panel/src/project_panel.rs @@ -62,7 +62,7 @@ use theme_settings::ThemeSettings; use ui::{ Color, ContextMenu, ContextMenuEntry, DecoratedIcon, Icon, IconDecoration, IconDecorationKind, IndentGuideColors, IndentGuideLayout, Indicator, KeyBinding, Label, LabelSize, ListItem, - ListItemSpacing, ProjectEmptyState, ScrollAxes, ScrollableHandle, Scrollbars, StickyCandidate, + ListItemSpacing, ProjectEmptyState, ScrollableHandle, Scrollbars, StickyCandidate, Tooltip, WithScrollbar, prelude::*, v_flex, }; use util::{ @@ -7087,15 +7087,9 @@ impl Render for ProjectPanel { ) .custom_scrollbars( { - let mut scrollbars = - Scrollbars::for_settings::() - .tracked_scroll_handle(&self.scroll_handle) - .with_overlay_track_along(ScrollAxes::Vertical); - if horizontal_scroll { - scrollbars = - scrollbars.with_overlay_track_along(ScrollAxes::Horizontal); - } - scrollbars.notify_content() + Scrollbars::for_settings::() + .tracked_scroll_handle(&self.scroll_handle) + .notify_content() }, window, cx, diff --git a/crates/settings_ui/src/settings_ui.rs b/crates/settings_ui/src/settings_ui.rs index e4e7f4ad4bf..02bbacdfa30 100644 --- a/crates/settings_ui/src/settings_ui.rs +++ b/crates/settings_ui/src/settings_ui.rs @@ -3477,19 +3477,12 @@ impl SettingsWindow { window.focus_prev(cx); })) .when(current_sub_page.is_none(), |this| { - this.custom_scrollbars( - Scrollbars::new(ui::ScrollAxes::Vertical) - .tracked_scroll_handle(&self.list_state) - .with_overlay_track_along(ui::ScrollAxes::Vertical), - window, - cx, - ) + this.vertical_scrollbar_for(&self.list_state, window, cx) }) .when_some(current_sub_page, |this, current_sub_page| { this.custom_scrollbars( Scrollbars::new(ui::ScrollAxes::Vertical) .tracked_scroll_handle(¤t_sub_page.scroll_handle) - .with_overlay_track_along(ui::ScrollAxes::Vertical) .id((current_sub_page.link.title.clone(), 42)), window, cx, diff --git a/crates/ui/src/components/scrollbar.rs b/crates/ui/src/components/scrollbar.rs index af29605f8e9..22bb47c6fd8 100644 --- a/crates/ui/src/components/scrollbar.rs +++ b/crates/ui/src/components/scrollbar.rs @@ -321,7 +321,6 @@ enum ReservedSpace { None, Thumb, Track, - OverlayTrack, StableTrack, } @@ -331,7 +330,7 @@ impl ReservedSpace { } fn needs_scroll_track(&self) -> bool { - matches!(self, Self::Track | Self::OverlayTrack | Self::StableTrack) + matches!(self, Self::Thumb | Self::Track | Self::StableTrack) } fn needs_space_reserved(&self, max_offset: Pixels) -> bool { @@ -474,11 +473,6 @@ impl Scrollbars { self } - pub fn with_overlay_track_along(mut self, along: ScrollAxes) -> Self { - self.visibility = along.apply_to(self.visibility, ReservedSpace::OverlayTrack); - self - } - pub fn with_stable_track_along(mut self, along: ScrollAxes, background_color: Hsla) -> Self { self.visibility = along.apply_to(self.visibility, ReservedSpace::StableTrack); self.track_color = Some(background_color);