diff --git a/crates/ui-egui/src/ui_kit/panel.rs b/crates/ui-egui/src/ui_kit/panel.rs index 7a211281d..5b32cafb3 100644 --- a/crates/ui-egui/src/ui_kit/panel.rs +++ b/crates/ui-egui/src/ui_kit/panel.rs @@ -1117,7 +1117,8 @@ impl<'a> Window<'a> { /// The same bounded card frame, either movable or an input-blocking modal. pub(super) fn surface(&self, ctx: &egui::Context, modal: bool, add: impl FnOnce(&mut Ui) -> (bool, super::Action)) -> (bool, super::Action) { let frame = if self.page_chrome { - super::navigation_popup_frame().inner_margin(0).fill(Tokens::get().dialog_body.gamma_multiply(0.97)) + // A system window covers what is behind it, like every other window (#9078). + super::navigation_popup_frame().inner_margin(0).fill(Tokens::get().dialog_body) } else { Panel::card_frame(ctx) }; diff --git a/crates/ui-egui/src/ui_kit/panel_tests.rs b/crates/ui-egui/src/ui_kit/panel_tests.rs index 1615425e0..d5ef0097e 100644 --- a/crates/ui-egui/src/ui_kit/panel_tests.rs +++ b/crates/ui-egui/src/ui_kit/panel_tests.rs @@ -592,6 +592,74 @@ fn window_pages_have_shared_metrics_callbacks_and_a_pinned_left_footer_action() crate::theme::set_dark(previous); } +#[test] +fn page_window_is_as_opaque_as_every_other_window_in_both_themes() { + // #9078: the Preferences window let the ribbon's labels show through its title bar and search field. + fn window_fill(pages: bool) -> egui::Color32 { + let ctx = crate::fonts::test_context(); + let list = [WindowPage { + group: None, + icon: "settings", + label: "ui.general", + handle: "test:page:general", + scroll: true, + draw: |ui, _: &mut ()| { + text(ui, "General", Text::Inline); + }, + }]; + let mut selected = 0; + let mut output = None; + for _ in 0..3 { + scenario::clear_handles(); + output = Some(crate::test_support::frame( + &ctx, + egui::RawInput { + screen_rect: Some(egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(900.0, 800.0))), + focused: true, + ..Default::default() + }, + |ui| { + let window = Window::new(ui.id().with("opaque"), "settings", "Preferences"); + if pages { + window.cards(3.0).show_pages(ui.ctx(), &mut selected, &list, &mut (), |_| {}); + } else { + window.show(ui.ctx(), true, |ui| { + text(ui, "Body", Text::Inline); + }); + } + }, + )); + } + let window = scenario::rect_of("dialog:window").expect("window rect published"); + let mut fill = None; + for clipped in output.iter().flat_map(|o| &o.shapes) { + crate::test_support::each_shape(&clipped.shape, &mut |shape| { + if let egui::Shape::Rect(r) = shape + && fill.is_none() + && r.blur_width == 0.0 + && (r.rect.min - window.min).abs().max_elem() <= 0.5 + && (r.rect.max - window.max).abs().max_elem() <= 0.5 + { + fill = Some(r.fill); + } + }); + } + fill.expect("the window frame is painted at the window's rect") + } + let previous = crate::theme::is_dark(); + for dark in [false, true] { + crate::theme::set_dark(dark); + let t = Tokens::get(); + assert_eq!(t.dialog_body.a(), 255, "{dark}: the window token itself is opaque"); + let plain = window_fill(false); + assert_eq!(plain, t.dialog_body, "{dark}: a plain window is the opaque dialog body"); + let page = window_fill(true); + assert_eq!(page.a(), 255, "{dark}: the Preferences page window lets nothing show through"); + assert_eq!(page, plain, "{dark}: the page window has the same fill as every other window"); + } + crate::theme::set_dark(previous); +} + #[test] fn confirm_routes_enter_escape_selected_answers_and_blocks_background_clicks() { for (key, valid, selected, expected) in [