From 89ec8ed9f421fb93fc10dce5de55d11bdb69f30a Mon Sep 17 00:00:00 2001 From: Cristi Radu Date: Thu, 12 Nov 2026 22:13:20 +0200 Subject: [PATCH] fix(ui): split view's active-pane line is drawn under open menus (#7010) The line had a layer of its own at Order::Foreground. egui draws a layer no area owns after every area of that order, so it crossed open menus and popups. Order::Middle keeps it over the pages and under the menus. --- crates/ui-egui/src/panes.rs | 6 ++++-- crates/ui-egui/tests/it/split_view.rs | 18 ++++++++++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/crates/ui-egui/src/panes.rs b/crates/ui-egui/src/panes.rs index 9dd906d725..61a722aca4 100644 --- a/crates/ui-egui/src/panes.rs +++ b/crates/ui-egui/src/panes.rs @@ -615,10 +615,12 @@ fn pane(app: &mut PdfCraftApp, ui: &mut egui::Ui, rect: Rect, place: Place, fron (Place::Second, None) => {} } app.panes.drawing = Place::Main; - // The active pane is marked along its top edge. + // The active pane is marked along its top edge: over the pages, under the menus (#7010). A + // layer with no area is drawn after every area of its order, so at Foreground it crossed + // open menus and popups. if active { let edge = Rect::from_min_size(rect.min, vec2(rect.width(), 2.0)); - ui.ctx().layer_painter(egui::LayerId::new(egui::Order::Foreground, egui::Id::unique(("active-pane", salt)))).rect_filled(edge, 0.0, t.accent); + ui.ctx().layer_painter(egui::LayerId::new(egui::Order::Middle, egui::Id::unique(("active-pane", salt)))).rect_filled(edge, 0.0, t.accent); } } diff --git a/crates/ui-egui/tests/it/split_view.rs b/crates/ui-egui/tests/it/split_view.rs index 2cbde22eb6..652eeaa253 100644 --- a/crates/ui-egui/tests/it/split_view.rs +++ b/crates/ui-egui/tests/it/split_view.rs @@ -315,3 +315,21 @@ fn closing_the_second_panes_tab_from_its_strip_keeps_the_program_running() { assert!(h.state().panes.split.is_none()); assert_eq!(h.state().views.len(), 1); } + +/// The line marking the active pane sits under the menus (#7010). It was painted on a layer of +/// its own at the menus' order, and egui draws such a layer after every menu and popup of that +/// order, so the line crossed an open menu. +#[test] +fn the_active_panes_line_is_drawn_under_the_menus() { + let mut h = harness(&["right.pdf", "left.pdf"]); + let right = index(&h, "right.pdf"); + h.state_mut().split_tab(right, false); + h.run_steps(4); + let painted = |h: &Harness<'static, PdfCraftApp>, order: egui::Order| { + ["main-pane", "second-pane"] + .iter() + .any(|salt| h.ctx.graphics(|g| g.get(egui::LayerId::new(order, egui::Id::unique(("active-pane", *salt)))).is_some())) + }; + assert!(!painted(&h, egui::Order::Foreground), "the line is not painted at the menus' order"); + assert!(painted(&h, egui::Order::Middle), "the line is painted above the pages, below the menus"); +}