From 97ffc03c81077f6945d1ab47160c4ba754d3e680 Mon Sep 17 00:00:00 2001 From: Hector Villarreal Date: Sat, 24 Oct 2026 15:33:56 -0600 Subject: [PATCH] fix(ui): the font menu opens on the current family's recent row (#9160) The open font menu marked the current family's alphabetical copy, even when it also headed the recent group, and opened scrolled to the top whatever the family, so the mark could be far out of view. As in Photoshop, the current family is now marked in the recent group when it is a recent one, the menu opens showing it (the recent group at the top, else the family's row at the top of the view), and the arrows walk on from the marked row. Applies to the options bar and the Character panel. Co-Authored-By: Claude Opus 5.5 --- crates/ui-egui/src/type_font_picker_tests.rs | 56 +++++++++++++------- crates/ui-egui/src/type_tool.rs | 20 +++++-- docs/ui-parity.md | 3 +- 3 files changed, 56 insertions(+), 23 deletions(-) diff --git a/crates/ui-egui/src/type_font_picker_tests.rs b/crates/ui-egui/src/type_font_picker_tests.rs index 12c1dec020..a5feeab7a9 100644 --- a/crates/ui-egui/src/type_font_picker_tests.rs +++ b/crates/ui-egui/src/type_font_picker_tests.rs @@ -768,27 +768,45 @@ fn open_menu_arrows_walk_on_through_recent_fonts() { } /// Opened on a family that is also a recent one (the usual case: every pick records it), the -/// arrows start from its alphabetical place, and only that row is marked. +/// menu marks its copy in the recent group, as Photoshop's does (#9160), and only that row; the +/// arrows walk on from there through the list as shown (Photoshop: ↓ goes to the next recent +/// family). #[test] -fn open_menu_on_a_recent_font_steps_through_the_alphabet() { +fn open_menu_on_a_recent_font_marks_its_recent_row() { use egui_kittest::kittest::NodeT; - for (key, want) in [(Key::ArrowDown, "Family 06"), (Key::ArrowUp, "Family 04")] { - let mut h = harness_with_recents(FontPreview::Off, vec!["Family 05".into(), "Family 09".into()]); - h.state_mut().current = "Family 05".into(); - h.run(); - open(&mut h); - let marked = |h: &Harness<'static, State>, label: &str| { - h.query_all_by_label(label).filter(|n| n.accesskit_node().toggled() == Some(egui::accesskit::Toggled::True)).count() - }; - assert_eq!(marked(&h, "Family 05"), 1, "one row marked"); - h.key_press(key); - h.run(); - assert_eq!(h.state().current, want); - h.key_press(Key::ArrowDown); - h.key_press(Key::ArrowUp); - h.run(); - assert_eq!(h.state().current, want, "and walks on from there"); - } + let mut h = harness_with_recents(FontPreview::Off, vec!["Family 05".into(), "Family 09".into()]); + h.state_mut().current = "Family 05".into(); + h.run(); + open(&mut h); + let marked = |h: &Harness<'static, State>, label: &str| -> Vec { + h.query_all_by_label(label).filter(|n| n.accesskit_node().toggled() == Some(egui::accesskit::Toggled::True)).map(|n| n.rect().top()).collect() + }; + let tops = |h: &Harness<'static, State>, label: &str| -> Vec { + let mut t: Vec = h.query_all_by_label(label).map(|n| n.rect().top()).collect(); + t.sort_by(f32::total_cmp); + t + }; + assert_eq!(marked(&h, "Family 05"), [tops(&h, "Family 05")[0]], "the upper (recent) copy alone is marked"); + h.key_press(Key::ArrowDown); + h.run(); + assert_eq!(h.state().current, "Family 09", "↓ walks on to the next recent family"); + h.key_press(Key::ArrowUp); + h.run(); + assert_eq!(h.state().current, "Family 05", "and ↑ back"); +} + +/// #9160: the menu opens showing the current family, as Photoshop's does: a family deep in the +/// list is scrolled to the top of the view, not left wherever the list happens to start. +#[test] +fn open_menu_shows_the_current_family() { + let mut h = harness_with_recents(FontPreview::Off, vec!["Zeta Sans".into()]); + h.state_mut().current = "Family 40".into(); + h.run(); + open(&mut h); + h.run(); + let popup = popup_rect(&h).expect("the menu is open"); + let row = h.query_all_by_label("Family 40").next().expect("its row").rect(); + assert!(popup.contains_rect(row), "Family 40 is in view: {row:?} in {popup:?}"); } /// The same through the real options bar, where the pick itself records the recent family. diff --git a/crates/ui-egui/src/type_tool.rs b/crates/ui-egui/src/type_tool.rs index e8fdbe95d3..5086b11ffc 100644 --- a/crates/ui-egui/src/type_tool.rs +++ b/crates/ui-egui/src/type_tool.rs @@ -1823,16 +1823,26 @@ pub(crate) fn family_picker_in( let ql = q.to_lowercase(); // The recent group stays as it was when the menu opened: each arrow step applies (and so // records) a family, and moving it to the top would send the next step back up. + let opening = ui.data(|d| d.get_temp::>(recents_id).is_none()); let open_recents: Vec = ui.data_mut(|d| d.get_temp_mut_or_insert_with(recents_id, || recents.to_vec()).clone()); let (rows, n_recent) = font_menu_rows(families, labels, &ql, &open_recents); // A recent family is listed twice. The current family's row is the one the last arrow - // selected while it still shows that family, else its alphabetical copy, so the arrows - // step through the alphabet as on the closed field. + // selected while it still shows that family, else its first copy: as in Photoshop, the + // one in the recent group when it has one (#9160), and the arrows walk on from there. let mut selected = ui .data(|d| d.get_temp::(row_id)) .filter(|&i| rows.get(i).is_some_and(|(f, _)| *f == current)) - .or_else(|| rows.iter().skip(n_recent).position(|(f, _)| *f == current).map(|i| i + n_recent)) .or_else(|| rows.iter().position(|(f, _)| *f == current)); + // The menu opens on the current family, as Photoshop's does: at the top of the list when + // it is a recent one, else its row at the top of the view. Kept until a laid-out pass + // (the popup's first pass only measures). + let reveal_id = search_id.with("reveal"); + if opening { + ui.data_mut(|d| d.insert_temp(reveal_id, true)); + } + let reveal = (ui.data(|d| d.get_temp::(reveal_id)).unwrap_or(false) && !ui.is_sizing_pass()) + .then(|| selected.map(|i| if i < n_recent { 0 } else { i })) + .flatten(); let mut stepped = None; if down || up { let next = match selected { @@ -1881,6 +1891,9 @@ pub(crate) fn family_picker_in( let response = ui.add_sized([330.0, row_h], button); if stepped == Some(i) { response.scroll_to_me(Some(egui::Align::Center)); + } else if reveal == Some(i) { + response.scroll_to_me(Some(egui::Align::Min)); + ui.data_mut(|d| d.remove::(reveal_id)); } if let Some((size, _)) = preview && ui.is_rect_visible(response.rect) @@ -1920,6 +1933,7 @@ pub(crate) fn family_picker_in( d.remove::(focus_id); d.remove::>(recents_id); d.remove::(row_id); + d.remove::(search_id.with("reveal")); }); } let hovered_font = response.inner.unwrap_or_default(); diff --git a/docs/ui-parity.md b/docs/ui-parity.md index 8a189ad491..1349e9ef85 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -1,6 +1,6 @@ # UI parity: tools, handles, modifiers and feel -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-23 · **Change:** minor (⌥ + an adjustment's shortcut reopens it at its last settings, ⌥⌘L / ⌥⌘M, #8900; Crop default mode: moving the image under the box snaps the frame's edges and centre, #8580; View › Extras hides the Move transform controls, #6699; adjustment clipping stays visible in compact Properties, #5231; Color panel modes from its panel menu, the same in every theme, UI-217-17, #6000; a picked colour recolours the selected type and shapes; Hand tool ⌘ / ⌥ are Zoom In / Zoom Out while held, #6434; the wheel steps value fields, #5473; a dragged guide shows its X or Y beside the pointer, #7680; Type options bar "T" icon scrubs the font size, #6437; Move tool: dragged selected pixels take their own outline as the selection, #7538; artboard backgrounds remain below child Free Transform previews; ⌫/Delete removes the selected smart filter, #4751; Object Finder foreground/background discrimination (#6548); rounded triangle, polygon and star corners; shape Fill/Stroke popovers accept hex RGB values, #6176; a guide let go over either ruler is removed, #6286; Crop rows corrected: saved crop presets and Delete Cropped Pixels off are done, #6562; marching ants in device pixels, #7489; Animated Zoom: holding the Zoom tool zooms continuously, #6210; shape Density and Feather, TOOL-214-12, #5846; Pen Auto Add/Delete on the path being drawn, #6140; Show Transform Controls frames every selected layer; guide keys and clicks; menu bar from the keyboard, #4988; Crop tool Content-Aware Fill; on-canvas corner radius widgets, TOOL-214-12; Curvature Pen edits the active path; Clip Thumbnails to Layer Bounds; Pen ⇧ 45°; last selected tool restored at launch; Layers panel filter-type dropdown with Kind, Name and Mode, #5048; Free Transform box and marching ants follow the selection, #5297; History: the trash deletes the selected snapshot, rows drag onto the trash, #5324; smart filter reordering by drag; smart object perspective row corrected to done, #426; Free Transform H/V skew fields; toolbar tool shortcuts can be reassigned; ⇧-dragged guides land on ruler ticks; layer and selection keys; tool keys; spring-loaded tool letters; type formatting keys; Pen Auto Add/Delete, #4144; smart filter rows; stale missing-tool rows corrected: Color Replacement, Red Eye and the Add/Delete Anchor Point pair are live toolbar tools, Frame landed; no percentage changed; selection-modifier and ⌥-wheel rows match their tests) · **Target:** Adobe Photoshop 2026 +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-24 · **Change:** minor (the font menu opens on the current family, marked in the recent group when it is a recent one, #9160; ⌥ + an adjustment's shortcut reopens it at its last settings, ⌥⌘L / ⌥⌘M, #8900; Crop default mode: moving the image under the box snaps the frame's edges and centre, #8580; View › Extras hides the Move transform controls, #6699; adjustment clipping stays visible in compact Properties, #5231; Color panel modes from its panel menu, the same in every theme, UI-217-17, #6000; a picked colour recolours the selected type and shapes; Hand tool ⌘ / ⌥ are Zoom In / Zoom Out while held, #6434; the wheel steps value fields, #5473; a dragged guide shows its X or Y beside the pointer, #7680; Type options bar "T" icon scrubs the font size, #6437; Move tool: dragged selected pixels take their own outline as the selection, #7538; artboard backgrounds remain below child Free Transform previews; ⌫/Delete removes the selected smart filter, #4751; Object Finder foreground/background discrimination (#6548); rounded triangle, polygon and star corners; shape Fill/Stroke popovers accept hex RGB values, #6176; a guide let go over either ruler is removed, #6286; Crop rows corrected: saved crop presets and Delete Cropped Pixels off are done, #6562; marching ants in device pixels, #7489; Animated Zoom: holding the Zoom tool zooms continuously, #6210; shape Density and Feather, TOOL-214-12, #5846; Pen Auto Add/Delete on the path being drawn, #6140; Show Transform Controls frames every selected layer; guide keys and clicks; menu bar from the keyboard, #4988; Crop tool Content-Aware Fill; on-canvas corner radius widgets, TOOL-214-12; Curvature Pen edits the active path; Clip Thumbnails to Layer Bounds; Pen ⇧ 45°; last selected tool restored at launch; Layers panel filter-type dropdown with Kind, Name and Mode, #5048; Free Transform box and marching ants follow the selection, #5297; History: the trash deletes the selected snapshot, rows drag onto the trash, #5324; smart filter reordering by drag; smart object perspective row corrected to done, #426; Free Transform H/V skew fields; toolbar tool shortcuts can be reassigned; ⇧-dragged guides land on ruler ticks; layer and selection keys; tool keys; spring-loaded tool letters; type formatting keys; Pen Auto Add/Delete, #4144; smart filter rows; stale missing-tool rows corrected: Color Replacement, Red Eye and the Add/Delete Anchor Point pair are live toolbar tools, Frame landed; no percentage changed; selection-modifier and ⌥-wheel rows match their tests) · **Target:** Adobe Photoshop 2026 How PhotoCraft's direct manipulation compares with Photoshop 2026 (27.11.0): the toolbox, the handles and modifier keys of each gesture, nudging, snapping, numeric precision, navigation, @@ -244,6 +244,7 @@ Paragraph; the rest open as in-app floating windows. | Date | Change | Summary | |---|---|---| +| 2026-10-24 | minor | Font menus (options bar, Character panel): the current family is marked in the recent group when it is a recent one, and the menu opens showing it, as Photoshop's does; the arrows walk on from the marked row (#9160). Scores unchanged. | | 2026-10-22 | minor | Crop default mode: a drag inside an upright box snaps the frame's edges and centre to the document, layers, guides and grid, as a Classic Mode frame's move does (#8580); no percentage changed | | 2026-10-21 | minor | Adjustment clipping moved above Properties editors to remain visible in compact docks (#5231); scope, undo/redo and 8/16/32-bit pixel regressions; readiness estimate unchanged | | 2026-10-19 | minor | A guide being moved or dragged out of a ruler shows an `X:` / `Y:` position readout beside the pointer, from the zero point in the ruler unit (#7680) |