From 35ea594196f2ef41a78b8d40ef83959ed42cd5b2 Mon Sep 17 00:00:00 2001 From: skylar taylor-barrick Date: Thu, 22 Oct 2026 13:11:14 -0600 Subject: [PATCH] #4630: test that the scrollbar thumb stays visible under the pointer The stock thin scroll bar fades its handle to the track's opacity while the pointer is on it, so the thumb vanished. The test checks every theme's floating scroll style keeps the handle opaque and more opaque than the track. Without the override both are 0.6. --- crates/ui-egui/src/theme.rs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/crates/ui-egui/src/theme.rs b/crates/ui-egui/src/theme.rs index d637f193d08..d4d0c06fa90 100644 --- a/crates/ui-egui/src/theme.rs +++ b/crates/ui-egui/src/theme.rs @@ -1131,6 +1131,29 @@ mod tests { assert_eq!(ctx.zoom_factor(), 1.0); } + // Regression test for #4630: the stock thin scroll bar fades its handle to the same opacity + // as its track while the pointer is on it, so the thumb disappeared when it was grabbed. + #[test] + fn scrollbar_thumb_stays_more_visible_than_its_track_in_every_theme() { + for kind in ThemeKind::ALL { + let ctx = egui::Context::default(); + apply(&ctx, kind); + for theme in [egui::Theme::Dark, egui::Theme::Light] { + let scroll = ctx.style_of(theme).spacing.scroll; + if !scroll.floating { + continue; + } + assert!( + scroll.interact_handle_opacity > scroll.interact_background_opacity, + "{kind:?}/{theme:?}: handle {} vs track {} under the pointer", + scroll.interact_handle_opacity, + scroll.interact_background_opacity + ); + assert_eq!(scroll.interact_handle_opacity, 1.0, "{kind:?}/{theme:?}: the thumb is opaque under the pointer"); + } + } + } + /// The desktop app installs fonts and loads the saved UI Font Size in its first frame, while /// egui's default fonts are still active. Any size but Small then panicked on the next pass /// ("FontFamily::Name("medium") is not bound to any fonts") because the plugin rescaled a