diff --git a/crates/ui/src/docking/group_tests.rs b/crates/ui/src/docking/group_tests.rs index 62d6013f..e6f62fcd 100644 --- a/crates/ui/src/docking/group_tests.rs +++ b/crates/ui/src/docking/group_tests.rs @@ -531,7 +531,7 @@ fn drag_bar_menu_has_the_group_items_and_opens_from_the_keyboard() { h.run_steps(1); h.input_mut().events.push(Event::PointerButton { pos: at, button: PointerButton::Secondary, pressed: false, modifiers: Modifiers::NONE }); h.run_steps(2); - for label in ["Close Tab Group", "Minimize", "Float Tab Group", "Move Group to"] { + for label in ["Close Tab Group", "Minimize", "Float Tab Group", "Move Group To"] { assert_eq!(h.query_all_by_label(label).count(), 1, "{label}"); } h.get_by_label("Close Tab Group").click(); diff --git a/crates/ui/src/docking/labels.rs b/crates/ui/src/docking/labels.rs index 7e8a60ee..4a4799c5 100644 --- a/crates/ui/src/docking/labels.rs +++ b/crates/ui/src/docking/labels.rs @@ -4,7 +4,9 @@ use super::DockStyle; impl DockStyle { /// Replace every `*_label` field with `translate(key)`, keeping the English default where it - /// returns `None`. An application translates the docking chrome in one place: + /// returns `None`. The defaults of menu items are in title case; those of controls, which + /// only screen readers announce, in sentence case. An application translates the docking + /// chrome in one place: /// /// ``` /// fn dock_style(ui: &egui::Ui) -> craft_ui::docking::DockStyle { @@ -17,8 +19,8 @@ impl DockStyle { /// /// | Key | Field | English default | /// |---|---|---| - /// | `dock.float` | `float_label` | Float panel | - /// | `dock.close` | `close_label` | Close panel | + /// | `dock.float` | `float_label` | Float Panel | + /// | `dock.close` | `close_label` | Close Panel | /// | `dock.movePanelTo` | `move_panel_to_label` | Move Panel to Group | /// | `dock.panels` | `panels_label` | Panels | /// | `dock.resize` | `resize_label` | Resize panels | @@ -28,7 +30,7 @@ impl DockStyle { /// | `dock.minimize` | `minimize_label` | Minimize | /// | `dock.expand` | `expand_label` | Expand | /// | `dock.floatGroup` | `float_group_label` | Float Tab Group | - /// | `dock.moveGroupTo` | `move_group_to_label` | Move Group to | + /// | `dock.moveGroupTo` | `move_group_to_label` | Move Group To | /// | `dock.moveColumn` | `move_column_label` | Move panel column | /// | `dock.collapseToIcons` | `collapse_to_icons_label` | Collapse to Icons | /// | `dock.expandPanels` | `expand_panels_label` | Expand Panels | diff --git a/crates/ui/src/docking/render/group.rs b/crates/ui/src/docking/render/group.rs index cb44cd8a..e38208a1 100644 --- a/crates/ui/src/docking/render/group.rs +++ b/crates/ui/src/docking/render/group.rs @@ -258,7 +258,7 @@ impl Renderer<'_, P> { } /// The group items of the menu tail: Close Tab Group, Minimize or Expand, Float Tab Group - /// and Move Group to. `panel` is the panel whose menu this is. + /// and Move Group To. `panel` is the panel whose menu this is. fn group_menu(&mut self, ui: &mut Ui, owner: &TabGroup<'_, P>, panel: &P) { let all = |check: &dyn Fn(crate::docking::Permissions) -> bool| owner.panels.iter().all(|p| check(self.permissions(p))); let closable = self.style.close_menu_items && all(&|p| p.closable); diff --git a/crates/ui/src/docking/surface.rs b/crates/ui/src/docking/surface.rs index 1a162b68..1a93cac2 100644 --- a/crates/ui/src/docking/surface.rs +++ b/crates/ui/src/docking/surface.rs @@ -93,7 +93,7 @@ pub struct DockStyle { pub restore_frame_label: String, /// Shown where native windows are available (feature `native-windows`). pub new_window_label: String, - /// Show the built-in Close items in tab and group menus (Close panel, Close Tab Group, + /// Show the built-in Close items in tab and group menus (Close Panel, Close Tab Group, /// Close Other Panels in Group) for closable panels. A host that draws its own Close items /// turns this off and keeps [`Permissions::closable`], so its close actions still apply. pub close_menu_items: bool, @@ -130,8 +130,8 @@ impl DockStyle { border: visuals.widgets.noninteractive.bg_stroke, accent: visuals.selection.stroke.color, font: FontId::proportional(12.0), - float_label: "Float panel".into(), - close_label: "Close panel".into(), + float_label: "Float Panel".into(), + close_label: "Close Panel".into(), move_panel_to_label: "Move Panel to Group".into(), panels_label: "Panels".into(), resize_label: "Resize panels".into(), @@ -141,7 +141,7 @@ impl DockStyle { minimize_label: "Minimize".into(), expand_label: "Expand".into(), float_group_label: "Float Tab Group".into(), - move_group_to_label: "Move Group to".into(), + move_group_to_label: "Move Group To".into(), drag_bar_width: 40.0, floating_background: visuals.window_fill, floating_stroke: visuals.window_stroke, diff --git a/crates/ui/src/docking/tests.rs b/crates/ui/src/docking/tests.rs index d2e9ae76..7dc09345 100644 --- a/crates/ui/src/docking/tests.rs +++ b/crates/ui/src/docking/tests.rs @@ -1260,7 +1260,7 @@ fn popup_action_labels_use_custom_visual_text_and_logical_accessibility() { h.input_mut().events.push(Event::PointerButton { pos: at, button: PointerButton::Secondary, pressed: false, modifiers: Modifiers::NONE }); h.run_steps(2); assert!(egui::Popup::is_any_open(&h.ctx)); - for logical in ["Float panel", "Move Panel to Group", "Close panel"] { + for logical in ["Float Panel", "Move Panel to Group", "Close Panel"] { assert!( h.output().shapes.iter().any(|shape| paints(&shape.shape, &format!("Action visual: {logical}"))), "custom action must paint: {logical}" diff --git a/crates/ui/src/docking/trial_tests.rs b/crates/ui/src/docking/trial_tests.rs index 584f28e9..2afee3cb 100644 --- a/crates/ui/src/docking/trial_tests.rs +++ b/crates/ui/src/docking/trial_tests.rs @@ -319,8 +319,8 @@ fn hidden_close_controls_leave_closing_to_the_host() { d.step(vec![secondary(false)]); d.step(vec![]); let painted = |d: &Driver, label: &str| texts(d).iter().any(|(_, t)| t.galley.text() == label); - assert!(painted(&d, "Float panel"), "the tab menu is open"); - assert!(!painted(&d, "Close panel") && !painted(&d, "Close Tab Group")); + assert!(painted(&d, "Float Panel"), "the tab menu is open"); + assert!(!painted(&d, "Close Panel") && !painted(&d, "Close Tab Group")); // The panels stay closable: the host's own Close applies and reports what it closed. assert_eq!(d.layout.apply_with_permissions(Action::CloseWindow { panel: 5 }, |p| d.content.permissions(p)), Ok(vec![5, 6])); } diff --git a/docs/ui-docking.md b/docs/ui-docking.md index befbf0b6..1a1aae4d 100644 --- a/docs/ui-docking.md +++ b/docs/ui-docking.md @@ -250,7 +250,7 @@ the app's command registry. App-specific aliases stay in the app. ## Labels Every visible and accessibility label is a `*_label` field of `DockStyle`, with an English -default. `DockStyle::localized` sets them all from one keyed lookup: +default: title case for menu items, sentence case for names only screen readers announce. `DockStyle::localized` sets them all from one keyed lookup: ```rust,ignore let style = DockStyle::from_ui(ui).localized(|key| app.strings.get(key).cloned());