From 034a1080b0bf8156a52a767c87b5ff064893b464 Mon Sep 17 00:00:00 2001 From: Eric Kaden <608341+EricKaden@users.noreply.github.com> Date: Mon, 19 Oct 2026 18:17:04 -0400 Subject: [PATCH] M6: a long drop-down list keeps its scroll bar in view --- crates/ui-egui/src/forms_ui.rs | 19 +++++++++++++++++++ crates/ui-egui/tests/forms.rs | 16 ++++++++++++++++ parity/acrobat-features.toml | 2 +- 3 files changed, 36 insertions(+), 1 deletion(-) diff --git a/crates/ui-egui/src/forms_ui.rs b/crates/ui-egui/src/forms_ui.rs index f684c28934..2e86d2c5fe 100644 --- a/crates/ui-egui/src/forms_ui.rs +++ b/crates/ui-egui/src/forms_ui.rs @@ -605,6 +605,25 @@ pub(crate) fn overlay(ctx: &egui::Context, view: &mut DocView, info: &DocInfo, f |ui| { ui.style_mut().visuals = egui::Visuals::light(); ui.spacing_mut().item_spacing = vec2(0.0, 0.0); + // A scroll bar that stays shown beside the items, so a longer list says so and + // where it is scrolled to; it replaces the fade at the bottom edge. + ui.spacing_mut().scroll = egui::style::ScrollStyle { + bar_width: 8.0, + dormant_background_opacity: 1.0, + active_background_opacity: 1.0, + interact_background_opacity: 1.0, + dormant_handle_opacity: 1.0, + active_handle_opacity: 1.0, + interact_handle_opacity: 1.0, + ..egui::style::ScrollStyle::solid() + }; + ui.spacing_mut().scroll.fade.strength = 0.0; + // The bar's track and handle, gray on the white list. + let v = ui.visuals_mut(); + v.extreme_bg_color = Color32::from_gray(236); + v.widgets.inactive.bg_fill = Color32::from_gray(168); + v.widgets.hovered.bg_fill = Color32::from_gray(132); + v.widgets.active.bg_fill = Color32::from_gray(100); egui::Frame::new().fill(Color32::WHITE).stroke(Stroke::new(1.0, Color32::from_gray(64))).show(ui, |ui| { let width = rect.width().max(24.0); ui.set_width(width); diff --git a/crates/ui-egui/tests/forms.rs b/crates/ui-egui/tests/forms.rs index 7913701ac7..25db3e404d 100644 --- a/crates/ui-egui/tests/forms.rs +++ b/crates/ui-egui/tests/forms.rs @@ -1122,3 +1122,19 @@ fn a_drop_downs_list_opens_as_wide_as_the_field_without_its_internal_name() { h.run_steps(4); assert_eq!(value(&h, "country"), ["fr"]); } + +#[test] +fn a_long_drop_down_list_keeps_its_scroll_bar_beside_the_items() { + let mut h = harness(); + let options: Vec = (0..30).map(|i| format!("{i:02}00")).collect(); + assert!(h.state_mut().apply_edit(pdfcraft_engine::Edit::SetFieldProps { + name: "country".into(), + props: Box::new(pdfcraft_engine::FieldProps { options: Some(options), ..Default::default() }), + })); + h.run_steps(3); + click_field(&mut h, "country", 0); + let country = field_rect(&h, "country"); + let first = egui_kittest::kittest::Queryable::get_by_label(&h, "0000").rect(); + // A scroll bar that stays shown takes its own room, so people see there is more below. + assert!(first.right() <= country.right() - 6.0, "{first:?} leaves room for the bar in {country:?}"); +} diff --git a/parity/acrobat-features.toml b/parity/acrobat-features.toml index c9439bf218..c37e458946 100644 --- a/parity/acrobat-features.toml +++ b/parity/acrobat-features.toml @@ -4441,7 +4441,7 @@ status = "shipped" commands = ["form.fields"] tools = ["form_fill"] evidence = ["crates/ui-egui/tests/forms.rs::check_boxes_radios_and_choices", "crates/ui-egui/tests/forms.rs::a_drop_downs_list_opens_as_wide_as_the_field_without_its_internal_name", "crates/forms/src/tests.rs::choices_accept_exports_or_display_text"] -notes = "combo and list boxes, multi-select lists; editable combo boxes accept free text. A combo box shows its arrow on screen and opens its list under the field, as wide as the box and in its text size, black on white; the list takes no arrow keys yet" +notes = "combo and list boxes, multi-select lists; editable combo boxes accept free text. A combo box shows its arrow on screen and opens its list under the field, as wide as the box and in its text size, black on white, with a scroll bar shown beside a longer list; the list takes no arrow keys yet" [[feature]] id = "form.push-buttons"