Make Thumb use full-height track hitbox, remove OverlayTrack

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 <noreply@anthropic.com>
This commit is contained in:
Aaron Ang 2026-05-20 15:42:50 -07:00
parent cc22aaadd6
commit 119ef17316
3 changed files with 6 additions and 25 deletions

View file

@ -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::<ProjectPanelScrollbarProxy>()
.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::<ProjectPanelScrollbarProxy>()
.tracked_scroll_handle(&self.scroll_handle)
.notify_content()
},
window,
cx,

View file

@ -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(&current_sub_page.scroll_handle)
.with_overlay_track_along(ui::ScrollAxes::Vertical)
.id((current_sub_page.link.title.clone(), 42)),
window,
cx,

View file

@ -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<ScrollHandle: ScrollableHandle> Scrollbars<ScrollHandle> {
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);