From 459a3dba5767d9fe739a1effcd3859546811fd8c Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Thu, 26 Nov 2026 23:43:05 +0000 Subject: [PATCH] red-pilot-gallery-1: the File view rail keeps the side-menu width; long labels ellipsize The rail took its content width (long labels pushed the page out) and its nested navigation narrowed short labels. It now lays at the token width through Flow and the navigation fills it. Written by a Codex red fixer; committed by the lead. Co-Authored-By: Claude Opus 5.5 --- crates/menu/src/ribbon/backstage.rs | 106 ++++++++++++++-------------- 1 file changed, 53 insertions(+), 53 deletions(-) diff --git a/crates/menu/src/ribbon/backstage.rs b/crates/menu/src/ribbon/backstage.rs index 4ae69f8398..31d8dbe7b1 100644 --- a/crates/menu/src/ribbon/backstage.rs +++ b/crates/menu/src/ribbon/backstage.rs @@ -13,7 +13,7 @@ use craft_ui::contract::{ Show as _, ShowContainer as _, Sizing, }; use craft_ui::display::{Divider, Text}; -use craft_ui::layout_components::{Row, Stack}; +use craft_ui::layout_components::Stack; use craft_ui::primitives::{HAlign, IconSpec}; use craft_ui::runtime::commands::{self, CommandSet as _, Commands as _}; use craft_ui::runtime::env::{Env, Label, with_env}; @@ -104,63 +104,63 @@ impl<'a, K: Clone + Eq + Hash + Send + Sync + Debug + 'static> BackstageView<'a, enter }); } - Row::new().gap(Gap::None).fill().show(ui, |ui, _| { - with_env( - ui, - |overrides| { - overrides.values.set(ControlPlace::SideMenu); - }, - |ui| { - Stack::new() - .label(words.navigation.clone()) - .surface(SurfaceKind::Chrome) - .least_width(LeastWidth::SideMenu) - .sizing(Sizing::FillHeight) - .gap(Gap::None) - .show(ui, |ui, _| { - if self.back { - let back = Button::new(words.back.clone()) - .icon(craft_behavior::IconId::new("chevron_left")) - .variant(Variant::GHOST) - .sizing(Sizing::FillWidth) - .align(HAlign::Start) - .show(ui); - if craft_ui::contract::clicked(&back.response) { - event = Some(BackstageEvent::Back); - } + let (rail, page_room) = craft_behavior::Flow::new(frame.rect, frame.env.direction().is_rtl()) + .take_start(LeastWidth::SideMenu.points(&Env::of(ui).tokens).min(frame.rect.width())); + with_env( + ui, + |overrides| { + overrides.values.set(ControlPlace::SideMenu); + }, + |ui| { + Stack::new() + .label(words.navigation.clone()) + .surface(SurfaceKind::Chrome) + .least_width(LeastWidth::SideMenu) + .fill() + .gap(Gap::None) + .show_at(ui, rail, |ui, _| { + if self.back { + let back = Button::new(words.back.clone()) + .icon(craft_behavior::IconId::new("chevron_left")) + .variant(Variant::GHOST) + .sizing(Sizing::FillWidth) + .align(HAlign::Start) + .show(ui); + if craft_ui::contract::clicked(&back.response) { + event = Some(BackstageEvent::Back); } - Navigation::new(arrival).show(ui, |ui, _| { - Stack::new().fill_width().gap(Gap::None).show(ui, |ui, _| { - for (at, group) in self.groups.iter().filter(|group| !group.is_empty()).enumerate() { - if at > 0 { - Divider::horizontal().show(ui); - } - self.entries(ui, menu_id, group, self.focus_shown || enter, &mut event); - } - }); - // Filling room keeps the bottom entries at their edge in the same roving group. - Stack::new().fill().show(ui, |_, _| {}); - Stack::new().fill_width().gap(Gap::None).show(ui, |ui, _| { - if !self.bottom.is_empty() { + } + Navigation::new(arrival).show(ui, |ui, _| { + Stack::new().fill_width().gap(Gap::None).show(ui, |ui, _| { + for (at, group) in self.groups.iter().filter(|group| !group.is_empty()).enumerate() { + if at > 0 { Divider::horizontal().show(ui); } - self.entries(ui, menu_id, self.bottom, self.focus_shown || enter, &mut event); - }); + self.entries(ui, menu_id, group, self.focus_shown || enter, &mut event); + } + }); + // Filling room keeps the bottom entries at their edge in the same roving group. + Stack::new().fill().show(ui, |_, _| {}); + Stack::new().fill_width().gap(Gap::None).show(ui, |ui, _| { + if !self.bottom.is_empty() { + Divider::horizontal().show(ui); + } + self.entries(ui, menu_id, self.bottom, self.focus_shown || enter, &mut event); }); }); - }, - ); - Stack::new().surface(SurfaceKind::Panel).fill().pad(Pad::Page).scroll(Scroll::vertical()).show(ui, |ui, _| { - let env = Env::of(ui); - let room = ui.available_rect_before_wrap(); - let rect = egui::Rect::from_min_size(room.min, egui::vec2(room.width().min(env.tokens.size.page.column), room.height())); - ui.scope_builder(UiBuilder::new().max_rect(rect), |ui| { - Stack::new().fill_width().gap(Gap::PageSection).show(ui, |ui, body| { - if let Some(heading) = &self.heading { - Text::new(heading.clone()).role(TypeRole::Title).show(ui); - } - page(ui, body); }); + }, + ); + Stack::new().surface(SurfaceKind::Panel).fill().pad(Pad::Page).scroll(Scroll::vertical()).show_at(ui, page_room.rect(), |ui, _| { + let env = Env::of(ui); + let room = ui.available_rect_before_wrap(); + let rect = egui::Rect::from_min_size(room.min, egui::vec2(room.width().min(env.tokens.size.page.column), room.height())); + ui.scope_builder(UiBuilder::new().max_rect(rect), |ui| { + Stack::new().fill_width().gap(Gap::PageSection).show(ui, |ui, body| { + if let Some(heading) = &self.heading { + Text::new(heading.clone()).role(TypeRole::Title).show(ui); + } + page(ui, body); }); }); }); @@ -222,7 +222,7 @@ impl Navigation { Self { common: Common::new(), props: ContainerProps::new() - .sizing(Sizing::FillHeight) + .sizing(Sizing::Fill) .layout(BodyLayout::stack()) .body_gap(Gap::None) .roving(Roving::new(NavShape::Flat).wrap(true)),