From a55b73c71f4fc7a0a2fbc36dbc1c3f5eec4f19d0 Mon Sep 17 00:00:00 2001 From: Yonatan Langer Date: Mon, 9 Nov 2026 14:42:49 +0200 Subject: [PATCH] Preferences: the Interface size slider is labelled again The egui 0.37 migration (#1350) dropped the slider's own text ("Interface size") and kept only its accessible name, so the dialog showed a bare "1.00" with nothing saying what it changes. The slider now sits in a row with an "Interface size:" label, laid out like the Measurement units row below it. Its accessible name is unchanged. Test: the_interface_size_slider_is_labelled_on_screen (the label is shown, before the slider, on the same row). --- crates/ui-egui/src/dialogs/body.rs | 10 ++++++++-- crates/ui-egui/src/dialogs/preferences_tests.rs | 12 ++++++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/crates/ui-egui/src/dialogs/body.rs b/crates/ui-egui/src/dialogs/body.rs index 932cd469a..ce8f6e511 100644 --- a/crates/ui-egui/src/dialogs/body.rs +++ b/crates/ui-egui/src/dialogs/body.rs @@ -1351,8 +1351,14 @@ fn dlg_preferences(app: &mut SlideApp, ui: &mut Ui, d: &mut Dialog) -> bool { // on release, and at once from the keyboard. let pending = d.fields.get("uiScale").and_then(|v| v.parse::().ok()); let mut scale = pending.unwrap_or(app.ui.ui_scale); - let r = ui.add(egui::Slider::new(&mut scale, 0.75..=1.75)); - // No visible label here (the row is laid out to fit); the accessible name only. + // Labelled like the Measurement units row below it. The egui 0.37 migration (#1350) dropped + // the slider's own text and kept only its accessible name, which left a bare "1.00". + let r = ui + .horizontal(|ui| { + ui.label("Interface size:"); + ui.add(egui::Slider::new(&mut scale, 0.75..=1.75)) + }) + .inner; let enabled = r.enabled(); r.widget_info(|| egui::WidgetInfo::slider(enabled, f64::from(scale), "Interface size")); if r.is_pointer_button_down_on() { diff --git a/crates/ui-egui/src/dialogs/preferences_tests.rs b/crates/ui-egui/src/dialogs/preferences_tests.rs index c3a3ebfbd..549220b93 100644 --- a/crates/ui-egui/src/dialogs/preferences_tests.rs +++ b/crates/ui-egui/src/dialogs/preferences_tests.rs @@ -39,6 +39,18 @@ fn dark(app: &SlideApp) -> bool { app.ui.brightness == Brightness::Dark } +/// The interface size slider has a visible label, not just a bare "1.00" beside it. +#[test] +fn the_interface_size_slider_is_labelled_on_screen() { + let mut h = harness(); + open_options(&mut h); + let label = h.query_by_label("Interface size:").expect("the slider's label is shown"); + let slider = interface_size(&h); + let (label, slider) = (label.rect(), slider.rect()); + assert!(label.max.x <= slider.min.x, "the label sits before the slider: {label:?}, {slider:?}"); + assert!(label.center().y > slider.min.y && label.center().y < slider.max.y, "on the same row: {label:?}, {slider:?}"); +} + /// A checkbox applies as it is toggled and Cancel puts the old value back. #[test] fn options_cancel_undoes_the_changes() {