diff --git a/crates/ui-egui/src/app/input.rs b/crates/ui-egui/src/app/input.rs index 1a170a3f11..b6c7eaae97 100644 --- a/crates/ui-egui/src/app/input.rs +++ b/crates/ui-egui/src/app/input.rs @@ -17,7 +17,9 @@ impl VectorcraftApp { if self.fonts_ready { tools_float::cancel_move_on_escape(self, ctx); crate::custom_toolbars::cancel_move_on_escape(self, ctx); - shortcuts::handle(self, ctx); + if !crate::menus::handle_keyboard_input(self, ctx) { + shortcuts::handle(self, ctx); + } } // A Copy taken in this UI phase (an egui copy event, or a command it runs) is published in // this same pass: waiting for the next `tick` can leave the command unissued when an idle diff --git a/crates/ui-egui/src/menus.rs b/crates/ui-egui/src/menus.rs index 6adb103f1f..781b6a9f63 100644 --- a/crates/ui-egui/src/menus.rs +++ b/crates/ui-egui/src/menus.rs @@ -46,6 +46,7 @@ mod bar; mod context; mod entries; mod invoke; +mod keyboard; mod labels; mod run; mod slots; @@ -71,6 +72,9 @@ pub(crate) use invoke::graph_dialog; #[cfg(test)] pub(crate) use invoke::with_held_keys; pub use invoke::{click_target, invoke, invoke_from_system_menu}; +pub(crate) use keyboard::handle_input as handle_keyboard_input; +// Shared numeric fields preserve their caret when a transient menu returns their focus. +pub(crate) use keyboard::restoring_field_focus; pub(crate) use labels::lists_plugin; pub(crate) use labels::shows_a_name; pub use labels::{CONTEXT_LABELS, DYNAMIC_LABELS, display_label, dynamic_label, item_shortcut, menu_strings}; diff --git a/crates/ui-egui/src/menus/bar.rs b/crates/ui-egui/src/menus/bar.rs index 10e0f6ed13..d0e1d237d7 100644 --- a/crates/ui-egui/src/menus/bar.rs +++ b/crates/ui-egui/src/menus/bar.rs @@ -1,33 +1,37 @@ use super::entries::{Row, entry, shown_shortcut}; use super::invoke::{field_event, focused_text_field, invoke, to_field, with_held_keys}; +use super::keyboard::{self, AccessRow, SourcePath}; use super::tree::menu_tree_named; use super::{Entry, Item, Tokens, Value, VectorcraftApp, widgets}; /// Render the menu bar. /// The in-window menu bar. Returns where its titles end (x): the bar itself takes the full width. pub fn menu_bar(app: &mut VectorcraftApp, ui: &mut egui::Ui) -> f32 { - let t = Tokens::get(ui.ctx()); let ctx = ui.ctx().clone(); // The press that opens a menu takes the keyboard from a focused text field: the field and its // selection are kept while the menus are open, so their Select All, Cut, Copy and Paste act on // its text (#516), the frame after the click that chose them (that click takes the keyboard // from it again). type Field = (egui::Id, egui::text_edit::TextEditState); - let (field_key, chosen_key) = (egui::Id::unique("menu-bar-field"), egui::Id::unique("menu-bar-field-event")); + let chosen_key = egui::Id::unique("menu-bar-field-event").with(ctx.viewport_id()); if let Some(((field, state), e)) = ctx.data(|d| d.get_temp::<(Field, egui::Event)>(chosen_key)) { ctx.data_mut(|d| d.remove::<(Field, egui::Event)>(chosen_key)); - state.store(&ctx, field); + keyboard::restore_field(&ctx, field, state); to_field(&ctx, field, e); } - if let Some(field) = focused_text_field(&ctx).and_then(|id| Some((id, egui::TextEdit::load_state(&ctx, id)?))) { - ctx.data_mut(|d| d.insert_temp::(field_key, field)); - } - let mut clicked: Option<(String, Value)> = None; - let mut file_open = false; + keyboard::remember_field(&ctx); + keyboard::begin_bar(&ctx); let tree = menu_tree_named(app.session.prefs.font_names_in_english); // No application menu in the window: the bar starts at File on every // platform. The VectorCraft menu stays in the tree: the native Mac bar takes it from there. let tree: Vec<(&str, Vec)> = tree.into_iter().filter(|(title, _)| *title != "VectorCraft").collect(); + let root_rows = keyboard::root_rows(&tree); + let show_cues = keyboard::cues(&ctx); + // Only the bar temporarily sees no resting pointer while keyboard navigation owns it. + // Real movement/clicks keep normal pointer menus; restore before refresh/invoke/other UI. + let pointer = keyboard::suppress_stationary_hover(&ctx).then(|| ctx.input_mut(|i| std::mem::take(&mut i.pointer))); + let mut clicked: Option<(String, Value)> = None; + let mut file_open = false; // A menu bar for its layout and menu-button style, but the titles use `Popup::menu` directly: // egui 0.37's `MenuButton` opens the title under a resting pointer while another menu is open, // and the app switches titles on movement only (`switch_on_hover`, the native behaviour). @@ -35,10 +39,12 @@ pub fn menu_bar(app: &mut VectorcraftApp, ui: &mut egui::Ui) -> f32 { .ui(ui, |ui| { let mut titles = Vec::with_capacity(tree.len()); for (title, items) in tree.iter() { - let text = egui::RichText::new(tl!(title)).size(13.0).color(t.text); - let resp = ui.add(egui::Button::new(text)); + let cue = root_rows.iter().find(|r| r.label == crate::i18n::t(title)).and_then(|r| r.cue.as_ref()).filter(|_| show_cues); + let text = keyboard::text(ui, crate::i18n::t(title), "", cue, Some(13.0)); + let resp = ui.push_id(("menu-bar-root", *title), |ui| ui.add(egui::Button::new(text))).inner; crate::palette::note_spot(ui, resp.rect, || crate::palette::SpotAt::Menu((*title).to_string())); - egui::Popup::menu(&resp).show(|ui| menu_body(app, ui, items, &mut clicked)); + keyboard::bind_root(&ctx, title, &resp); + egui::Popup::menu(&resp).show(|ui| bar_menu_body(app, ui, items, &keyboard::root_path(title), &mut clicked)); if *title == "File" { file_open = egui::Popup::is_id_open(ui.ctx(), egui::Popup::default_response_id(&resp)); } @@ -47,6 +53,10 @@ pub fn menu_bar(app: &mut VectorcraftApp, ui: &mut egui::Ui) -> f32 { (ui.cursor().min.x, switch_on_hover(ui.ctx(), &titles)) }) .inner; + if let Some(pointer) = pointer { + ctx.input_mut(|i| i.pointer = pointer); + } + keyboard::finish_bar(&ctx, open, clicked.is_some()); // The File menu opening reads the Scripts folder again, for File › Scripts. let file_key = egui::Id::unique("menu-bar-file-open"); let file_was_open = ctx.data(|d| d.get_temp::(file_key)).unwrap_or(false); @@ -58,9 +68,9 @@ pub fn menu_bar(app: &mut VectorcraftApp, ui: &mut egui::Ui) -> f32 { // while one is, or the menu would open under them. ctx.data_mut(|d| d.insert_temp(menu_open_id(), open)); - let field = ctx.data(|d| d.get_temp::(field_key)); - if !open && focused_text_field(&ctx).is_none() { - ctx.data_mut(|d| d.remove::(field_key)); + let field = keyboard::field(&ctx); + if !open && !keyboard::active(&ctx) && focused_text_field(&ctx).is_none() { + keyboard::forget_field(&ctx); } if let Some((id, p)) = clicked { match field.and_then(|f| Some((f, field_event(app, &id)?))) { @@ -123,10 +133,37 @@ pub(super) fn menu_body(app: &VectorcraftApp, ui: &mut egui::Ui, items: &[Item], }); } +fn bar_menu_body(app: &VectorcraftApp, ui: &mut egui::Ui, items: &[Item], path: &SourcePath, clicked: &mut Option<(String, Value)>) { + if !keyboard::active(ui.ctx()) && !keyboard::cues(ui.ctx()) { + menu_body(app, ui, items, clicked); + return; + } + widgets::menu_scroll(ui, |ui| { + widgets::menu_min_width(ui, 230.0); + render_items_scoped(app, ui, items, true, Some(path), clicked); + }); +} + /// `items` as menu buttons; with `checks`, items that can be on or off show a check mark (or the /// room for one). pub(super) fn render_items(app: &VectorcraftApp, ui: &mut egui::Ui, items: &[Item], checks: bool, clicked: &mut Option<(String, Value)>) { + render_items_scoped(app, ui, items, checks, None, clicked); +} + +fn render_items_scoped( + app: &VectorcraftApp, + ui: &mut egui::Ui, + items: &[Item], + checks: bool, + path: Option<&SourcePath>, + clicked: &mut Option<(String, Value)>, +) { let t = Tokens::get(ui.ctx()); + let rows = path.map(|p| keyboard::level(app, p, items)).unwrap_or_default(); + let mut rows = rows.iter(); + if let Some(path) = path { + keyboard::note_level(ui.ctx(), path); + } for e in items.iter().filter_map(|it| entry(app, it)) { match e { Entry::Sep => { @@ -136,14 +173,40 @@ pub(super) fn render_items(app: &VectorcraftApp, ui: &mut egui::Ui, items: &[Ite ui.label(egui::RichText::new(h).size(11.0).color(t.text_dim)); } Entry::Sub(label, children) => { - ui.menu_button(label, |ui| { - widgets::menu_scroll(ui, |ui| { - widgets::menu_min_width(ui, 200.0); - render_items(app, ui, children, checks || shows_marks(app, children), clicked); + if let Some(access) = rows.next() { + ui.push_id(access.key.salt(), |ui| { + let cue = access.cue.as_ref().filter(|_| keyboard::cues(ui.ctx())); + let text = keyboard::text(ui, label, "", cue, None); + if !ui.is_sizing_pass() { + keyboard::prepare_submenu(ui.ctx(), access, ui.next_auto_id()); + } + let (response, _) = egui::menu::SubMenuButton::new(text).ui(ui, |ui| { + widgets::menu_scroll(ui, |ui| { + widgets::menu_min_width(ui, 200.0); + render_items_scoped( + app, + ui, + children, + checks || shows_marks(app, children), + Some(&keyboard::child_path(&access.key)), + clicked, + ); + }); + }); + if !ui.is_sizing_pass() { + keyboard::bind_response(ui.ctx(), access, &response); + } }); - }); + } else { + ui.menu_button(label, |ui| { + widgets::menu_scroll(ui, |ui| { + widgets::menu_min_width(ui, 200.0); + render_items(app, ui, children, checks || shows_marks(app, children), clicked); + }); + }); + } } - Entry::Item(row) => render_row(app, ui, &row, checks, clicked), + Entry::Item(row) => render_row(app, ui, &row, checks, rows.next(), clicked), } } } @@ -163,24 +226,28 @@ fn only_toggles(app: &VectorcraftApp, items: &[Item]) -> bool { /// One menu item: its label (with a check mark, or the room for one, under `checks`), its shortcut, /// and Type › Font's samples. -fn render_row(app: &VectorcraftApp, ui: &mut egui::Ui, row: &Row, checks: bool, clicked: &mut Option<(String, Value)>) { +fn render_row(app: &VectorcraftApp, ui: &mut egui::Ui, row: &Row, checks: bool, access: Option<&AccessRow>, clicked: &mut Option<(String, Value)>) { let sc = row.shortcut.map(shown_shortcut).unwrap_or_default(); let Some((id, p)) = row.command else { ui.add_enabled_ui(false, |ui| { - ui.add(egui::Button::new(row.label.as_ref()).shortcut_text(sc)); + let cue = access.and_then(|r| r.cue.as_ref()).filter(|_| keyboard::cues(ui.ctx())); + let text = keyboard::text(ui, row.label.as_ref(), "", cue, None); + ui.add(egui::Button::new(text).shortcut_text(sc)); }) .response .on_disabled_hover_text(tl!("Coming soon — tracked in the parity plan")); return; }; - let text = match row.checked.filter(|_| checks) { - Some(true) => format!("✓ {}", row.label), - Some(false) => format!(" {}", row.label), - None => row.label.to_string(), + let prefix = match row.checked.filter(|_| checks) { + Some(true) => "✓ ", + Some(false) => " ", + None => "", }; + let cue = access.and_then(|r| r.cue.as_ref()).filter(|_| keyboard::cues(ui.ctx())); + let text = keyboard::text(ui, row.label.as_ref(), prefix, cue, None); // Type → Font: each family's sample after its name (Enable in-menu font previews). let sampled = p.get("font").and_then(Value::as_str).filter(|_| id == "text.setStyle" && app.session.prefs.font_preview); - let r = match sampled { + let draw = |ui: &mut egui::Ui| match sampled { Some(family) => { let slot = egui::IdSalt::new(("font-sample", family)); let button = egui::Button::new(text).right_text(egui::Atom::custom(slot, crate::font_menu::MENU_SAMPLE_SIZE)); @@ -192,12 +259,22 @@ fn render_row(app: &VectorcraftApp, ui: &mut egui::Ui, row: &Row, checks: bool, } None => ui.add_enabled(row.enabled, egui::Button::new(text).shortcut_text(sc)), }; + let r = match access { + Some(access) => ui.push_id(access.key.salt(), draw).inner, + None => draw(ui), + }; + let keyboard_chosen = !ui.is_sizing_pass() && access.is_some_and(|access| keyboard::bind_response(ui.ctx(), access, &r)); let r = match (row.enabled, disabled_hint(app, id)) { (false, Some(why)) => r.on_disabled_hover_text(why), _ => r, }; - if r.clicked() { - *clicked = row.target().map(|target| with_held_keys(target, ui.input(|i| i.modifiers))); + if r.clicked() || keyboard_chosen { + *clicked = row.target().map(|target| { + if access.is_none() || r.clicked_by(egui::PointerButton::Primary) { with_held_keys(target, ui.input(|i| i.modifiers)) } else { target } // access-key Alt is not an Alt-click alternate action + }); + if access.is_some() { + keyboard::chosen(ui.ctx()); + } ui.close(); } } diff --git a/crates/ui-egui/src/menus/keyboard.rs b/crates/ui-egui/src/menus/keyboard.rs new file mode 100644 index 0000000000..6c496a67b3 --- /dev/null +++ b/crates/ui-egui/src/menus/keyboard.rs @@ -0,0 +1,940 @@ +//! Access keys for the in-window menu bar. Native menu labels and command shortcuts stay separate. + +use std::collections::HashSet; +use std::ops::Range; + +use egui::{Context, Event, Id, Key, Modifiers, Response}; +use serde_json::Value; + +use super::{Entry, Item, VectorcraftApp, entry}; + +#[derive(Clone, Debug, PartialEq, Eq)] +pub(super) struct SubKey { + source: String, + contents: Id, +} + +#[derive(Clone, Debug, PartialEq, Eq)] +pub(super) struct SourcePath { + root: String, + parents: Vec, +} + +#[derive(Clone, Debug, PartialEq)] +enum Kind { + Sub(SubKey), + Command(String, Value), + Unavailable(String), +} + +#[derive(Clone, Debug, PartialEq)] +pub(super) struct TargetKey { + path: SourcePath, + kind: Kind, + // Dynamic slots can keep their command id while naming a different saved item. + binding: Id, +} + +impl TargetKey { + pub(super) fn salt(&self) -> String { + format!("menu-access:{self:?}") + } +} + +#[derive(Clone)] +pub(super) struct Cue { + folded: String, + range: Range, +} + +#[derive(Clone)] +pub(super) struct AccessRow { + pub key: TargetKey, + pub label: String, + pub cue: Option, + pub enabled: bool, + preferred: Option, +} + +type Field = (Id, egui::text_edit::TextEditState); + +#[derive(Clone, Default)] +struct State { + active: bool, + root: Option, + open: bool, + path: Vec, + focus: Option, + focus_request: Option, + scroll_request: Option, + first_request: Option, + root_request: bool, + activate: Option, + collision: Option<(String, Vec, usize)>, + invalidated: bool, + alt_down: bool, + alt_armed: bool, + alt_used: bool, + composing: bool, + modifiers: Modifiers, + keyboard_pointer: bool, + origin: Option, + document: Option, + titles: Vec<(String, Id, Id)>, + registry: Vec<(Id, TargetKey)>, + shown: Vec, +} + +fn state_id(ctx: &Context) -> Id { + Id::unique("menu-bar-access").with(ctx.viewport_id()) +} + +fn read(ctx: &Context) -> State { + let id = state_id(ctx); + ctx.data(|d| d.get_temp(id)).unwrap_or_default() +} + +fn write(ctx: &Context, state: State) { + let id = state_id(ctx); + ctx.data_mut(|d| d.insert_temp(id, state)); +} + +// Row rendering borrows the stored state in place: never clone its whole growing registry. +// Context/focus/scroll calls belong outside this data lock. +fn with_state(ctx: &Context, f: impl FnOnce(&mut State) -> R) -> R { + let id = state_id(ctx); + ctx.data_mut(|d| f(d.get_temp_mut_or_default::(id))) +} + +fn field_id(ctx: &Context) -> Id { + Id::unique("menu-bar-field").with(ctx.viewport_id()) +} + +pub(super) fn remember_field(ctx: &Context) { + if let Some(id) = super::invoke::focused_text_field(ctx) + && let Some(state) = egui::TextEdit::load_state(ctx, id) + { + let key = field_id(ctx); + ctx.data_mut(|d| d.insert_temp(key, (id, state))); + } +} + +pub(super) fn field(ctx: &Context) -> Option { + let id = field_id(ctx); + ctx.data(|d| d.get_temp(id)) +} + +// A menu's focus return resumes the same edit, rather than beginning a new numeric edit. +// Keep the marker for every pass of this frame; a sizing/discard pass must not reselect all. +fn restoration_id(ctx: &Context, field: Id) -> Id { + field.with(("menu-bar-resume-selection", ctx.viewport_id())) +} + +pub(super) fn restore_field(ctx: &Context, id: Id, saved: egui::text_edit::TextEditState) { + let marker = restoration_id(ctx, id); + let frame = ctx.cumulative_frame_nr(); + ctx.data_mut(|d| d.insert_temp(marker, frame)); + saved.store(ctx, id); + ctx.memory_mut(|m| m.request_focus(id)); +} + +pub(crate) fn restoring_field_focus(ctx: &Context, field: Id) -> bool { + let marker = restoration_id(ctx, field); + let frame = ctx.cumulative_frame_nr(); + ctx.data_mut(|d| { + let restoring = d.get_temp::(marker) == Some(frame); + if !restoring { + d.remove_temp::(marker); + } + restoring + }) +} + +pub(super) fn forget_field(ctx: &Context) { + let id = field_id(ctx); + ctx.data_mut(|d| d.remove::(id)); +} + +fn supported(ctx: &Context) -> bool { + matches!(ctx.os(), egui::os::OperatingSystem::Windows | egui::os::OperatingSystem::Nix) +} + +pub(super) fn active(ctx: &Context) -> bool { + with_state(ctx, |state| state.active) +} + +fn cancel(ctx: &Context, state: &mut State, restore: bool) { + for (_, _, popup) in &state.titles { + egui::Popup::close_id(ctx, *popup); + } + state.active = false; + state.open = false; + state.root_request = false; + state.focus_request = None; + state.scroll_request = None; + state.first_request = None; + state.activate = None; + state.collision = None; + state.path.clear(); + if restore { + if let Some((id, saved)) = field(ctx) { + restore_field(ctx, id, saved); + } else if let Some(id) = state.origin { + ctx.memory_mut(|m| m.request_focus(id)); + } else if let Some(id) = ctx.memory(|m| m.focused()) { + ctx.memory_mut(|m| m.surrender_focus(id)); + } + } + if !restore + && let Some(focused) = ctx.memory(|m| m.focused()) + && (state.titles.iter().any(|(_, id, _)| *id == focused) || state.registry.iter().any(|(id, _)| *id == focused)) + { + ctx.memory_mut(|m| m.surrender_focus(focused)); + } + state.origin = None; + ctx.request_repaint(); +} + +fn enter(app: &VectorcraftApp, ctx: &Context, state: &mut State) { + if !state.active { + remember_field(ctx); + state.origin = ctx.memory(|m| m.focused()); + state.document = app.session.active().map(|d| d.uid); + state.active = true; + } + state.keyboard_pointer = true; +} + +fn choose_root(app: &VectorcraftApp, ctx: &Context, state: &mut State, root: String, open: bool) { + enter(app, ctx, state); + for (_, _, popup) in &state.titles { + egui::Popup::close_id(ctx, *popup); + } + // Closing a popup alone keeps egui's open-submenu state for the next pass. A newly + // selected root must discard those descendants before reopening in this same pass. + ctx.data_mut(|data| data.remove_by_type::()); + state.root = Some(root.clone()); + state.invalidated = false; + state.open = open; + state.path.clear(); + state.focus = None; + state.focus_request = None; + state.scroll_request = None; + state.activate = None; + state.collision = None; + state.root_request = true; + state.first_request = open.then_some(SourcePath { root, parents: vec![] }); + ctx.request_repaint(); +} + +fn folded(text: &str) -> String { + text.chars().flat_map(char::to_lowercase).collect() +} + +fn characters(label: &str) -> Vec { + let mut out = vec![]; + let mut seen = HashSet::new(); + let mut push = |at: usize, ch: char| { + let key = folded(&ch.to_string()); + if seen.insert(key.clone()) { + out.push(Cue { folded: key, range: at..at + ch.len_utf8() }); + } + }; + // Word initials first, then all letters/digits. Literal punctuation is a last resort for a + // user-named row containing no other character; it is never interpreted as markup. + let mut initial = true; + for (at, ch) in label.char_indices() { + if ch.is_alphanumeric() && initial { + push(at, ch); + } + initial = !ch.is_alphanumeric(); + } + for (at, ch) in label.char_indices().filter(|(_, c)| c.is_alphanumeric()) { + push(at, ch); + } + for (at, ch) in label.char_indices().filter(|(_, c)| !c.is_whitespace() && !c.is_control()) { + push(at, ch); + } + out +} + +fn assign(rows: &mut [AccessRow]) { + let mut occupied = HashSet::new(); + // Reserve the reported paths before earlier siblings take their letters. + for row in rows.iter_mut() { + if let Some(wanted) = row.preferred.map(|c| folded(&c.to_string())) + && let Some(cue) = characters(&row.label).into_iter().find(|c| c.folded == wanted) + { + occupied.insert(cue.folded.clone()); + row.cue = Some(cue); + } + } + for row in rows.iter_mut().filter(|r| r.cue.is_none()) { + let choices = characters(&row.label); + row.cue = choices.iter().find(|c| !occupied.contains(&c.folded)).or_else(|| choices.first()).cloned(); + if let Some(cue) = &row.cue { + occupied.insert(cue.folded.clone()); + } + } +} + +fn roots(app: &VectorcraftApp) -> Vec<(&'static str, Vec)> { + super::menu_tree_named(app.session.prefs.font_names_in_english).into_iter().filter(|(name, _)| *name != "VectorCraft").collect() +} + +pub(super) fn root_rows(tree: &[(&str, Vec)]) -> Vec { + let mut rows: Vec<_> = tree + .iter() + .map(|(source, _)| AccessRow { + key: TargetKey { + path: SourcePath { root: (*source).into(), parents: vec![] }, + kind: Kind::Unavailable((*source).into()), + binding: Id::unique(("menu-root-binding", source, crate::i18n::t(source))), + }, + label: crate::i18n::t(source).into(), + cue: None, + enabled: true, + preferred: match *source { + "File" => Some('f'), + "Edit" => Some('e'), + "Object" => Some('o'), + "Type" => Some('t'), + "Select" => Some('s'), + "Effect" => Some('c'), + "View" => Some('v'), + "Window" => Some('w'), + "Help" => Some('h'), + _ => None, + }, + }) + .collect(); + assign(&mut rows); + rows +} + +fn sub_key(source: &str, items: &[Item]) -> SubKey { + // Source names, command ids and params (not translated labels or visible row positions). + // A changed dynamic folder definition invalidates its old selection rather than retargeting it. + SubKey { source: source.into(), contents: Id::unique(("menu-submenu-definition", format!("{items:?}"))) } +} + +pub(super) fn root_path(source: &str) -> SourcePath { + SourcePath { root: source.into(), parents: vec![] } +} + +pub(super) fn child_path(key: &TargetKey) -> SourcePath { + let mut path = key.path.clone(); + if let Kind::Sub(sub) = &key.kind { + path.parents.push(sub.clone()); + } + path +} + +pub(super) fn level(app: &VectorcraftApp, path: &SourcePath, items: &[Item]) -> Vec { + let mut rows = vec![]; + for item in items { + match entry(app, item) { + Some(Entry::Sub(label, children)) => { + let Item::Sub(source, _) = item else { continue }; + rows.push(AccessRow { + key: TargetKey { + path: path.clone(), + kind: Kind::Sub(sub_key(source, children)), + binding: Id::unique(("menu-submenu-binding", source, label)), + }, + label: label.into(), + cue: None, + enabled: true, + preferred: (path.root == "Object" && path.parents.is_empty() && *source == "Path").then_some('p'), + }); + } + Some(Entry::Item(row)) => { + let target = row.target(); + let preferred = row.command.and_then(|(id, _)| match id { + "object.path.offsetPath" => Some('o'), + "select.save" if path.root == "Select" && path.parents.is_empty() => Some('s'), + "select.editSaved" if path.root == "Select" && path.parents.is_empty() => Some('e'), + _ => None, + }); + rows.push(AccessRow { + key: TargetKey { + path: path.clone(), + kind: target.map_or_else(|| Kind::Unavailable(row.source.into()), |(id, params)| Kind::Command(id, params)), + binding: Id::unique(("menu-row-binding", row.source, row.label.as_ref())), + }, + label: row.label.into_owned(), + cue: None, + enabled: row.enabled && row.command.is_some(), + preferred, + }); + } + _ => {} + } + } + assign(&mut rows); + rows +} + +fn current_rows(app: &VectorcraftApp, state: &State) -> Option> { + let root = state.root.as_deref()?; + let tree = roots(app); + let (_, items) = tree.iter().find(|(name, _)| *name == root)?; + let mut items = items.as_slice(); + for wanted in &state.path { + items = items.iter().find_map(|item| match item { + Item::Sub(source, children) if *source == wanted.source.as_str() && sub_key(source, children) == *wanted => Some(children.as_slice()), + _ => None, + })?; + } + Some(level(app, &SourcePath { root: root.into(), parents: state.path.clone() }, items)) +} + +fn mnemonic(rows: &[AccessRow], text: &str) -> Vec { + let folded = folded(text); + rows.iter().filter(|r| r.enabled && r.cue.as_ref().is_some_and(|c| c.folded == folded)).map(|r| r.key.clone()).collect() +} + +fn letter(app: &VectorcraftApp, ctx: &Context, state: &mut State, text: &str, fallback: Option<&str>, root_chord: bool) -> bool { + // A newly pressed Alt chord addresses the bar, even while a submenu is open. + let rows = if state.active && state.open && !root_chord { current_rows(app, state) } else { Some(root_rows(&roots(app))) }; + let Some(rows) = rows else { + cancel(ctx, state, true); + return true; + }; + let mut matches = mnemonic(&rows, text); + if matches.is_empty() + && let Some(fallback) = fallback + { + matches = mnemonic(&rows, fallback); + } + if matches.is_empty() { + return state.active; + } + if root_chord || !state.active || !state.open { + if let Some(target) = matches.first() { + choose_root(app, ctx, state, target.path.root.clone(), true); + } + return true; + } + let chosen = if matches.len() == 1 { + state.collision = None; + matches.first().cloned() + } else { + let token = folded(text); + let index = match &state.collision { + Some((old, keys, at)) if old == &token && keys == &matches => (at + 1) % matches.len(), + _ => 0, + }; + let chosen = matches.get(index).cloned(); + state.collision = Some((token, matches, index)); + chosen + }; + if let Some(chosen) = chosen { + state.invalidated = false; + state.focus_request = Some(chosen.clone()); + state.focus = Some(chosen.clone()); + // A submenu mnemonic focuses its genuine button; real Right/Enter enters it through + // egui, including its RTL and stationary-pointer handling. Collisions require Enter. + if matches!(chosen.kind, Kind::Command(..)) && state.collision.is_none() { + state.activate = Some(chosen); + } + state.keyboard_pointer = true; + ctx.request_repaint(); + } + true +} + +fn owner_blocks(app: &VectorcraftApp, ctx: &Context, state: &State) -> bool { + !supported(ctx) + || !ctx.input(|i| i.focused) + || app.file_dialog_open() + || app.ui.dialog.is_some() + || app.ui.palette_open + || app.ui.screen_mode == 3 + || app.ui.tools_drawer + || crate::updates_ui::blocks_input(app) + || !app.held_tool.is_empty() + || app.session.tool_busy() + || app.session.tool_composing() + || state.composing + || crate::scrub::phase(ctx) != crate::scrub::Phase::Idle + || crate::canvas::dragging(ctx) + || ctx.dragged_id().is_some() +} + +fn update_composition(ctx: &Context, state: &mut State, events: &[Event]) -> bool { + if !events.iter().any(|e| matches!(e, Event::ModifiersChanged(_) | Event::Key { .. })) { + state.modifiers = ctx.input(|i| i.modifiers); + } + let mut ime = false; + for event in events { + match event { + Event::Ime(egui::ImeEvent::Preedit { text, .. }) => { + state.composing = !text.is_empty(); + ime = true; + } + Event::Ime(egui::ImeEvent::Commit(_)) => { + state.composing = false; + ime = true; + } + #[allow(deprecated)] + Event::Ime(egui::ImeEvent::Disabled) => { + state.composing = false; + ime = true; + } + Event::Ime(_) => ime = true, + Event::WindowFocused(false) => { + state.alt_down = false; + state.alt_armed = false; + state.composing = false; + } + _ => {} + } + } + ime +} + +fn prepare_input(app: &VectorcraftApp, ctx: &Context, state: &mut State, events: &[Event]) -> Option { + let ime = update_composition(ctx, state, events); + if ime || owner_blocks(app, ctx, state) { + if state.active { + cancel(ctx, state, ime && app.ui.dialog.is_none()); + } + state.alt_armed = false; + return None; + } + if !state.active && egui::Popup::is_any_open(ctx) { + if let Some((source, _, _)) = state.titles.iter().find(|(_, _, id)| egui::Popup::is_id_open(ctx, *id)).cloned() { + enter(app, ctx, state); + state.root = Some(source); + state.open = true; + state.keyboard_pointer = false; + } else { + state.alt_armed = false; + return None; // context menu/popover owns its own keys + } + } + refresh_targets(app, ctx, state); + let pointer_activity = ctx.input(|i| i.pointer.delta() != egui::Vec2::ZERO || i.pointer.any_click() || i.pointer.any_down()); + if pointer_activity { + state.invalidated = false; + state.keyboard_pointer = false; + state.alt_armed = false; + } + Some(pointer_activity) +} + +fn refresh_targets(app: &VectorcraftApp, ctx: &Context, state: &mut State) { + if state.active && state.document != app.session.active().map(|d| d.uid) { + cancel(ctx, state, false); + } + if !state.root_request + && !state.invalidated + && let Some(focused) = ctx.memory(|m| m.focused()) + && let Some((_, key)) = state.registry.iter().find(|(id, _)| *id == focused) + { + state.focus = Some(key.clone()); + state.path = key.path.parents.clone(); + } + // Re-resolve current labels/targets; a vanished dynamic target never invokes its replacement. + if state.active && state.open { + match current_rows(app, state) { + Some(rows) => { + if state.focus.as_ref().is_some_and(|key| !rows.iter().any(|r| &r.key == key)) { + if let Some(id) = ctx.memory(|m| m.focused()) { + ctx.memory_mut(|m| m.surrender_focus(id)); + } + state.invalidated = true; + state.first_request = None; + state.scroll_request = None; + state.focus = None; + state.focus_request = None; + state.activate = None; + state.collision = None; + } + } + None => { + if let Some(id) = ctx.memory(|m| m.focused()) { + ctx.memory_mut(|m| m.surrender_focus(id)); + } + state.invalidated = true; + state.first_request = None; + state.scroll_request = None; + state.path.clear(); + state.focus = None; + state.focus_request = None; + state.activate = None; + state.collision = None; + } + } + } +} + +fn modifiers_changed(app: &VectorcraftApp, ctx: &Context, state: &mut State, m: &Modifiers, pointer_activity: bool, owned: &mut bool) { + let plain_alt = m.alt && !m.ctrl && !m.command && !m.mac_cmd; + if plain_alt && !state.alt_down { + state.alt_armed = !pointer_activity; + state.alt_used = false; + } + if !m.alt && state.alt_down { + if state.alt_armed && !state.alt_used { + *owned = true; + if state.active { + cancel(ctx, state, true); + } else { + choose_root(app, ctx, state, "File".into(), false); + } + } + state.alt_armed = false; + } + if m.ctrl || m.command || m.mac_cmd { + state.alt_armed = false; + state.alt_used = true; + if state.active { + cancel(ctx, state, true); + } + *owned = false; + } + state.alt_down = m.alt; +} + +fn consume_event(consumed: &mut [bool], at: usize) { + if let Some(c) = consumed.get_mut(at) { + *c = true; + } +} + +fn horizontal_navigation(app: &VectorcraftApp, ctx: &Context, state: &mut State, key: Key) -> bool { + let towards = if ctx.global_style().right_to_left { Key::ArrowLeft } else { Key::ArrowRight }; + let submenu = state.focus.as_ref().is_some_and(|f| matches!(f.kind, Kind::Sub(_))); + if key != towards || !submenu { + let roots = roots(app); + if let Some(index) = roots.iter().position(|(s, _)| Some(*s) == state.root.as_deref()) { + let forward = (key == Key::ArrowRight) != ctx.global_style().right_to_left; + let next = if forward { (index + 1) % roots.len() } else { (index + roots.len() - 1) % roots.len() }; + if let Some((root, _)) = roots.get(next) { + let was_open = state.open; + choose_root(app, ctx, state, (*root).into(), was_open); + } + } + return true; + } + false +} + +fn navigation_key(app: &VectorcraftApp, ctx: &Context, state: &mut State, key: Key, consumed: &mut [bool], at: usize, owned: &mut bool) -> bool { + match key { + Key::Enter | Key::Space if state.invalidated => { + // A disappeared item is not permission to activate the next slot, + // including when egui gives that replacement its default focus. + consume_event(consumed, at); + *owned = true; + true + } + Key::Escape if state.path.is_empty() => { + cancel(ctx, state, true); + *owned = true; + consume_event(consumed, at); + true + } + Key::Escape | Key::ArrowUp | Key::ArrowDown | Key::ArrowLeft | Key::ArrowRight | Key::Enter | Key::Space => { + if matches!(key, Key::ArrowLeft | Key::ArrowRight) && state.path.is_empty() { + if horizontal_navigation(app, ctx, state, key) { + consume_event(consumed, at); + } + } else if !state.open && matches!(key, Key::ArrowDown | Key::Enter | Key::Space) { + if let Some(root) = state.root.clone() { + choose_root(app, ctx, state, root, true); + } + consume_event(consumed, at); + } + *owned = true; + true // egui owns the remaining navigation keys + } + _ => false, + } +} + +fn pressed_key(app: &VectorcraftApp, ctx: &Context, state: &mut State, events: &[Event], at: usize, consumed: &mut [bool], owned: &mut bool) { + let Event::Key { key, physical_key, pressed: true, repeat, modifiers } = &events[at] else { + return; + }; + if modifiers.ctrl || modifiers.command || modifiers.mac_cmd || (modifiers.alt && matches!(key, Key::Tab | Key::Space)) { + state.alt_armed = false; + state.alt_used = true; + if state.active { + cancel(ctx, state, true); + *owned = false; + } + return; + } + let access = state.active || modifiers.alt; + if !access { + return; + } + if modifiers.alt && crate::shortcuts::runs_a_shortcut(key.name(), physical_key.unwrap_or(*key).name(), *modifiers) { + state.alt_armed = false; + state.alt_used = true; + if state.active { + cancel(ctx, state, true); + *owned = false; + } + return; + } + if state.active { + state.keyboard_pointer = true; + if matches!(key, Key::ArrowUp | Key::ArrowDown | Key::ArrowLeft | Key::ArrowRight) { + state.invalidated = false; + } + if navigation_key(app, ctx, state, *key, consumed, at, owned) { + return; + } + } + let root_chord = modifiers.alt && !state.alt_used; + state.alt_used = true; + state.alt_armed = false; + // Native input is Key then Text. Prefer its delivered Unicode text, while keeping + // the logical/Latin key as fallback. The pair is consumed together, exactly once. + let text_at = events + .iter() + .enumerate() + .skip(at + 1) + .take_while(|(_, e)| !matches!(e, Event::Key { pressed: true, .. } | Event::Ime(_))) + .find_map(|(i, e)| matches!(e, Event::Text(_)).then_some(i)); + let text = text_at.and_then(|i| events.get(i)).and_then(|e| if let Event::Text(t) = e { Some(t.as_str()) } else { None }); + let fallback = key.name(); + if !*repeat && letter(app, ctx, state, text.unwrap_or(fallback), Some(fallback), root_chord) || state.active { + *owned = true; + consume_event(consumed, at); + if let Some(i) = text_at { + consume_event(consumed, i); + } + } +} + +fn text_event(app: &VectorcraftApp, ctx: &Context, state: &mut State, text: &str, consumed: &mut [bool], at: usize, owned: &mut bool) { + if state.modifiers.ctrl || state.modifiers.command || state.modifiers.mac_cmd { + state.alt_armed = false; + state.alt_used = true; + if state.active { + cancel(ctx, state, true); + } + *owned = false; + // AltGr/Ctrl text belongs downstream, even without a Key event. + } else if state.active || state.alt_down && state.alt_armed { + let root_chord = state.alt_down && !state.alt_used; + state.alt_used = true; + state.alt_armed = false; + if letter(app, ctx, state, text, None, root_chord) || state.active { + *owned = true; + consume_event(consumed, at); + } + } +} + +/// Called only by App's existing once-per-frame gate, BEFORE ordinary shortcuts. +pub(crate) fn handle_input(app: &mut VectorcraftApp, ctx: &Context) -> bool { + let mut state = read(ctx); + let events = ctx.input(|i| i.events.clone()); + let Some(pointer_activity) = prepare_input(app, ctx, &mut state, &events) else { + write(ctx, state); + return false; + }; + let mut owned = state.active; + let mut consumed = vec![false; events.len()]; + for (at, event) in events.iter().enumerate() { + if consumed.get(at).copied().unwrap_or(false) { + continue; + } + match event { + Event::ModifiersChanged(m) + | Event::Key { modifiers: m, .. } + | Event::PointerButton { modifiers: m, .. } + | Event::MouseWheel { modifiers: m, .. } => state.modifiers = *m, + _ => {} + } + match event { + Event::ModifiersChanged(m) => modifiers_changed(app, ctx, &mut state, m, pointer_activity, &mut owned), + Event::Key { pressed: true, .. } => pressed_key(app, ctx, &mut state, &events, at, &mut consumed, &mut owned), + Event::Text(text) => text_event(app, ctx, &mut state, text, &mut consumed, at, &mut owned), + Event::PointerButton { .. } | Event::MouseWheel { .. } => { + // Preserve event order: wheel hands scrolling to the real pointer, but a later + // navigation key owns it again. Smoothed wheel tails must not undo that choice. + state.keyboard_pointer = false; + state.alt_armed = false; + state.alt_used = true; + } + _ => {} + } + } + ctx.input_mut(|i| { + let mut at = 0; + i.events.retain(|_| { + let keep = !consumed.get(at).copied().unwrap_or(false); + at += 1; + keep + }); + }); + write(ctx, state); + owned +} + +pub(super) fn begin_bar(ctx: &Context) { + with_state(ctx, |state| { + state.registry.clear(); + state.shown.clear(); + }); +} + +pub(super) fn cues(ctx: &Context) -> bool { + supported(ctx) && with_state(ctx, |state| state.active || state.alt_down && state.alt_armed) +} + +pub(super) fn suppress_stationary_hover(ctx: &Context) -> bool { + let keyboard = with_state(ctx, |state| state.active && state.keyboard_pointer); + keyboard && ctx.input(|i| i.pointer.delta() == egui::Vec2::ZERO && !i.pointer.any_click() && !i.pointer.any_down()) +} + +pub(super) fn bind_root(ctx: &Context, source: &str, response: &Response) { + let popup = egui::Popup::default_response_id(response); + let requested = with_state(ctx, |state| { + if let Some(root) = state.titles.iter_mut().find(|(name, _, _)| name == source) { + *root = (source.into(), response.id, popup); + } else { + state.titles.push((source.into(), response.id, popup)); + } + if state.active && state.root_request && state.root.as_deref() == Some(source) { + state.root_request = false; + Some(state.open) + } else { + None + } + }); + if let Some(open) = requested { + response.request_focus(); + if open { + egui::Popup::open_id(ctx, popup); + } else { + egui::Popup::close_id(ctx, popup); + } + } +} + +pub(super) fn note_level(ctx: &Context, path: &SourcePath) { + with_state(ctx, |state| state.shown.push(path.clone())); +} + +// The public SubMenuButton uses this same next_auto_id for its genuine button. Let its own +// Right/Enter/RTL path open it. Only request focus after releasing the data lock. +pub(super) fn prepare_submenu(ctx: &Context, row: &AccessRow, id: Id) { + let request = with_state(ctx, |state| { + let focus_here = match &state.focus_request { + Some(wanted) => wanted == &row.key, + None => state.first_request.as_ref() == Some(&row.key.path), + }; + if state.active && row.enabled && focus_here { + state.focus = Some(row.key.clone()); + state.focus_request = None; + state.first_request = None; + state.scroll_request = Some(row.key.clone()); + true + } else { + false + } + }); + if request { + ctx.memory_mut(|m| m.request_focus(id)); + } +} + +pub(super) fn bind_response(ctx: &Context, row: &AccessRow, response: &Response) -> bool { + let has_focus = response.has_focus(); + let (request_focus, scroll, activate) = with_state(ctx, |state| { + state.registry.push((response.id, row.key.clone())); + let scroll = state.scroll_request.as_ref() == Some(&row.key); + if scroll { + state.scroll_request = None; + } + let focus_here = match &state.focus_request { + Some(wanted) => wanted == &row.key, + None => state.first_request.as_ref() == Some(&row.key.path), + }; + let request_focus = state.active && row.enabled && focus_here; + if request_focus { + state.focus_request = None; + state.first_request = None; + state.focus = Some(row.key.clone()); + } + if has_focus && !state.invalidated { + state.focus = Some(row.key.clone()); + } + // Real egui arrow navigation changes focus without a helper focus_request. + // Keep that keyboard row visible, while pointer/wheel scrolling keeps its own position. + let focused_keyboard_row = state.active && state.keyboard_pointer && !state.invalidated && row.enabled && has_focus; + let activate = state.active && row.enabled && state.activate.as_ref() == Some(&row.key); + if activate { + state.activate = None; + state.active = false; + state.open = false; + state.root_request = false; + } + (request_focus, scroll || request_focus || focused_keyboard_row, activate) + }); + if request_focus { + response.request_focus(); + } + if scroll { + response.scroll_to_me(None); + } + activate +} + +pub(super) fn chosen(ctx: &Context) { + with_state(ctx, |state| { + state.active = false; + state.open = false; + state.activate = None; + state.root_request = false; + state.collision = None; + }); +} + +pub(super) fn finish_bar(ctx: &Context, open: bool, command_chosen: bool) { + let mut state = read(ctx); + if state.active { + if let Some((source, _, _)) = state.titles.iter().find(|(_, _, id)| egui::Popup::is_id_open(ctx, *id)).cloned() { + state.root = Some(source.clone()); + state.open = true; + state.path = + state.shown.iter().filter(|p| p.root == source).max_by_key(|p| p.parents.len()).map(|p| p.parents.clone()).unwrap_or_default(); + } else if !open && (state.open || ctx.input(|i| i.pointer.any_click())) { + // Bare Alt exposes cues without a popup; an outside click still ends access mode. + let restore = !command_chosen && !ctx.input(|i| i.pointer.any_click()); + cancel(ctx, &mut state, restore); + } + } + write(ctx, state); +} + +/// A layout job changes only presentation; literal '&'/'_' and all native/shared labels survive. +pub(super) fn text(ui: &egui::Ui, label: &str, prefix: &str, cue: Option<&Cue>, size: Option) -> egui::WidgetText { + let Some(cue) = cue else { + let text = format!("{prefix}{label}"); + return match size { + Some(size) => egui::RichText::new(text).size(size).color(super::Tokens::get(ui.ctx()).text).into(), + None => text.into(), + }; + }; + let Some((before, rest)) = label.split_at_checked(cue.range.start) else { return format!("{prefix}{label}").into() }; + let Some((letter, after)) = rest.split_at_checked(cue.range.len()) else { return format!("{prefix}{label}").into() }; + let mut font = egui::TextStyle::Button.resolve(ui.style()); + if let Some(size) = size { + font.size = size; + } + let format = egui::TextFormat { font_id: font, color: ui.visuals().text_color(), ..Default::default() }; + let mut job = egui::text::LayoutJob::default(); + job.append(&format!("{prefix}{before}"), 0.0, format.clone()); + job.append(letter, 0.0, egui::TextFormat { underline: egui::Stroke::new(1.0, format.color), ..format.clone() }); + job.append(after, 0.0, format); + job.into() +} diff --git a/crates/ui-egui/src/widgets/text.rs b/crates/ui-egui/src/widgets/text.rs index 8a9bfe1b8d..c6e3bd2dd3 100644 --- a/crates/ui-egui/src/widgets/text.rs +++ b/crates/ui-egui/src/widgets/text.rs @@ -200,7 +200,11 @@ pub(super) fn select_all_on_focus(ui: &Ui, resp: &Response, text: &str) { d.remove_temp::(press_pos); }); } - if !(resp.gained_focus() && !pressed || resp.double_clicked() || clicked_focus && !dragged) { + // Returning from a transient menu resumes its saved caret/selection. This is not the + // keyboard focus that starts a new numeric edit; pointer taps/double-clicks still select all. + // The menu helper's data borrow ends here, before TextEdit's state is loaded below. + let restored_focus = crate::menus::restoring_field_focus(ui.ctx(), resp.id); + if !(resp.gained_focus() && !pressed && !restored_focus || resp.double_clicked() || clicked_focus && !dragged) { return; } if let Some(st) = egui::TextEdit::load_state(ui.ctx(), resp.id) { diff --git a/crates/ui-egui/tests/menu_access_keys.rs b/crates/ui-egui/tests/menu_access_keys.rs new file mode 100644 index 0000000000..2389716d61 --- /dev/null +++ b/crates/ui-egui/tests/menu_access_keys.rs @@ -0,0 +1,1140 @@ +//! Main-menu access keys use the real App input and existing dialog routes. +#![cfg(not(target_os = "macos"))] +#![allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)] + +use std::sync::{Mutex, MutexGuard}; + +use egui::{Event, Key, Modifiers, PointerButton, Pos2, RawInput, Rect, Shape, vec2}; +use serde_json::json; +use vectorcraft_engine::Session; +use vectorcraft_ui_egui::{VectorcraftApp, i18n}; + +// These cases share the library's process-global locale. A failing baseline must not poison +// the passing pointer control, and Drop restores the previous locale even after an assertion. +static UI_STATE: Mutex<()> = Mutex::new(()); + +struct GlobalState { + language: i18n::Lang, + _lock: MutexGuard<'static, ()>, +} + +impl GlobalState { + fn new() -> Self { + let lock = UI_STATE.lock().unwrap_or_else(|e| e.into_inner()); + let language = i18n::current(); + i18n::set_current(i18n::Lang::EN); + Self { language, _lock: lock } + } +} + +impl Drop for GlobalState { + fn drop(&mut self) { + i18n::set_current(self.language); + } +} + +fn key(key: Key, pressed: bool, modifiers: Modifiers) -> Event { + Event::Key { key, physical_key: Some(key), pressed, repeat: false, modifiers } +} + +fn text_points(shape: &Shape, clip: Rect, out: &mut Vec<(String, Pos2)>) { + match shape { + Shape::Text(t) => { + let point = t.pos + vec2(4.0, 6.0); + if clip.contains(point) { + out.push((t.galley.text().to_string(), point)); + } + } + Shape::Vec(children) => children.iter().for_each(|shape| text_points(shape, clip, out)), + _ => {} + } +} + +struct Scene { + app: VectorcraftApp, + ctx: egui::Context, + time: f64, + shown: Vec<(String, Pos2)>, +} + +impl Scene { + fn new() -> Self { + let mut app = VectorcraftApp::new(Session::new(), Default::default()); + app.run("app.language", json!({"lang": "en"})).unwrap(); + i18n::set_current(i18n::Lang::EN); + app.run("file.new", json!({"width": 500, "height": 350})).unwrap(); + let id = app.run("shape.rectangle", json!({"x": 70, "y": 60, "width": 120, "height": 80})).unwrap()["id"].clone(); + app.run("select.set", json!({"ids": [id]})).unwrap(); + app.select_tool("selection"); + let ctx = egui::Context::default(); + vectorcraft_ui_egui::theme::install_fonts(&ctx); + vectorcraft_ui_egui::theme::apply(&ctx, Default::default()); + let mut s = Self { app, ctx, time: 0.0, shown: vec![] }; + for _ in 0..4 { + s.frame(vec![]); + } + assert!(s.app.ui.dialog.is_none()); + assert!(!s.ctx.egui_wants_keyboard_input(), "the initial idle canvas owns input"); + s + } + + fn frame(&mut self, events: Vec) { + self.time += 1.0 / 30.0; + let mut raw = RawInput { + events, + time: Some(self.time), + screen_rect: Some(Rect::from_min_size(Pos2::ZERO, vec2(1440.0, 1000.0))), + ..Default::default() + }; + self.app.raw_input_hook(&self.ctx, &mut raw); + let mut out = self.ctx.run_ui(raw, |ui| self.app.ui(ui)); + self.shown.clear(); + for clipped in &out.shapes { + text_points(&clipped.shape, clipped.clip_rect, &mut self.shown); + } + out.textures_delta.clear(); + } + + fn settle(&mut self) { + for _ in 0..3 { + self.frame(vec![]); + } + } + + fn letter(&mut self, key_id: Key, text: &str, modifiers: Modifiers) { + self.frame(vec![Event::ModifiersChanged(modifiers), key(key_id, true, modifiers), Event::Text(text.into())]); + self.frame(vec![key(key_id, false, modifiers)]); + } + + fn arrow(&mut self, key_id: Key) { + self.frame(vec![key(key_id, true, Modifiers::NONE)]); + self.frame(vec![key(key_id, false, Modifiers::NONE)]); + } + + fn point(&self, label: &str, popup: bool) -> Pos2 { + let points: Vec<_> = self + .shown + .iter() + .filter(|(text, point)| { + text.trim() == label && (!popup || self.ctx.layer_id_at(*point).is_some_and(|layer| layer.order == egui::Order::Foreground)) + }) + .map(|(_, point)| *point) + .collect(); + assert_eq!(points.len(), 1, "one visible {label:?} label required; found {points:?}"); + points[0] + } + + fn click(&mut self, pos: Pos2) { + self.frame(vec![Event::ModifiersChanged(Modifiers::NONE), Event::PointerMoved(pos)]); + self.frame(vec![Event::PointerButton { pos, button: PointerButton::Primary, pressed: true, modifiers: Modifiers::NONE }]); + self.frame(vec![Event::PointerButton { pos, button: PointerButton::Primary, pressed: false, modifiers: Modifiers::NONE }]); + self.settle(); + } + + fn assert_offset_dialog(&self) { + let d = self.app.ui.dialog.as_ref().expect("menu navigation must open a dialog"); + assert_eq!(d.kind, "offsetPath", "must invoke the existing Offset Path dialog, not another command"); + assert!(!d.bool("preview"), "a fresh Offset Path dialog opens with Preview off"); + assert!(self.shown.iter().any(|(text, _)| text == "Offset Path"), "the actual existing dialog must be drawn"); + } +} + +#[test] +fn menu_access_baseline_alt_sequence_opens_offset_path_without_editing() { + let _global = GlobalState::new(); + let mut s = Scene::new(); + let state = s.app.session.active().unwrap(); + let (document, selection) = (state.doc.clone(), state.selection.clone()); + let history = (state.history.undo.len(), state.history.redo.len()); + s.frame(vec![Event::ModifiersChanged(Modifiers::ALT)]); + s.letter(Key::O, "o", Modifiers::ALT); + s.frame(vec![Event::ModifiersChanged(Modifiers::NONE)]); + s.letter(Key::P, "p", Modifiers::NONE); + s.arrow(Key::ArrowRight); + s.letter(Key::O, "o", Modifiers::NONE); + s.settle(); + s.assert_offset_dialog(); + let state = s.app.session.active().unwrap(); + assert_eq!(state.doc, document, "opening the menu's dialog must not edit the art"); + assert_eq!(state.selection, selection); + assert_eq!((state.history.undo.len(), state.history.redo.len()), history); +} + +#[test] +fn menu_access_baseline_pointer_route_opens_same_offset_path_dialog() { + let _global = GlobalState::new(); + let mut s = Scene::new(); + let state = s.app.session.active().unwrap(); + let (document, selection) = (state.doc.clone(), state.selection.clone()); + let history = (state.history.undo.len(), state.history.redo.len()); + s.click(s.point("Object", false)); + let path = s.point("Path", true); + s.frame(vec![Event::PointerMoved(path)]); + s.settle(); + s.click(s.point("Offset Path\u{2026}", true)); + s.assert_offset_dialog(); + let state = s.app.session.active().unwrap(); + assert_eq!(state.doc, document); + assert_eq!(state.selection, selection); + assert_eq!((state.history.undo.len(), state.history.redo.len()), history); +} + +// Prospective full-contract cases. The baseline above stays byte-for-byte unchanged. +#[derive(Debug)] +struct Cue { + label: String, + character: char, + popup: bool, +} + +fn clean_label(text: &str) -> &str { + text.trim().trim_start_matches('\u{2713}').trim_start() +} + +fn painted_cues(shape: &Shape, clip: Rect, ctx: &egui::Context, out: &mut Vec) { + match shape { + Shape::Text(t) => { + let point = t.pos + vec2(4.0, 6.0); + if !clip.contains(point) { + return; + } + for section in &t.galley.job.sections { + if section.format.underline.width <= 0.0 { + continue; + } + let marked = + t.galley.job.text.get(section.byte_range.start.0..section.byte_range.end.0).expect("underline uses valid UTF-8 boundaries"); + let mut chars = marked.chars(); + let Some(character) = chars.next() else { continue }; + // Other widgets may underline whole strings. Only a single-character menu cue + // satisfies the assertions below; do not mistake unrelated styling for a cue. + if chars.next().is_some() { + continue; + } + out.push(Cue { + label: clean_label(t.galley.text()).into(), + character, + popup: ctx.layer_id_at(point).is_some_and(|layer| layer.order == egui::Order::Foreground), + }); + } + } + Shape::Vec(children) => children.iter().for_each(|shape| painted_cues(shape, clip, ctx, out)), + _ => {} + } +} + +impl Scene { + fn cues(&mut self) -> Vec { + self.at_size(vec![], vec2(1440.0, 1000.0)) + } + + fn at_size(&mut self, events: Vec, size: egui::Vec2) -> Vec { + self.at_size_focused(events, size, true) + } + + fn at_size_focused(&mut self, events: Vec, size: egui::Vec2, focused: bool) -> Vec { + self.time += 1.0 / 30.0; + let mut raw = + RawInput { events, focused, time: Some(self.time), screen_rect: Some(Rect::from_min_size(Pos2::ZERO, size)), ..Default::default() }; + self.app.raw_input_hook(&self.ctx, &mut raw); + let mut out = self.ctx.run_ui(raw, |ui| self.app.ui(ui)); + self.shown.clear(); + let mut cues = vec![]; + for clipped in &out.shapes { + text_points(&clipped.shape, clipped.clip_rect, &mut self.shown); + painted_cues(&clipped.shape, clipped.clip_rect, &self.ctx, &mut cues); + } + out.textures_delta.clear(); + cues + } + + fn window_focus(&mut self, focused: bool) { + // egui-winit supplies both the RawInput field and the event on native focus changes. + self.at_size_focused(vec![Event::WindowFocused(focused)], vec2(1440.0, 1000.0), focused); + } + + fn menu_diagnostic(&self) -> String { + let shown: Vec<_> = self + .shown + .iter() + .filter(|(_, point)| point.y < 40.0 || self.ctx.layer_id_at(*point).is_some_and(|layer| layer.order == egui::Order::Foreground)) + .take(36) + .collect(); + let focus = self.ctx.memory(|m| m.focused()).and_then(|id| self.ctx.read_response(id)).map(|r| r.rect); + format!( + "pref={} ui={} global={} input_focused={} focus_rect={focus:?} shown={shown:?}", + self.app.session.prefs.interface_language, + self.app.ui_language().code(), + i18n::current().code(), + self.ctx.input(|i| i.focused) + ) + } + + fn bare_alt(&mut self) { + self.frame(vec![Event::ModifiersChanged(Modifiers::ALT)]); + self.frame(vec![Event::ModifiersChanged(Modifiers::NONE)]); + self.settle(); + } + + fn root(&mut self, title: &str) { + let (key, text) = match title { + "File" => (Key::F, "f"), + "Edit" => (Key::E, "e"), + "Object" => (Key::O, "o"), + "Type" => (Key::T, "t"), + "Select" => (Key::S, "s"), + "Effect" => (Key::C, "c"), + "View" => (Key::V, "v"), + "Window" => (Key::W, "w"), + "Help" => (Key::H, "h"), + _ => panic!("unexpected root {title}"), + }; + self.frame(vec![Event::ModifiersChanged(Modifiers::ALT)]); + self.letter(key, text, Modifiers::ALT); + self.frame(vec![Event::ModifiersChanged(Modifiers::NONE)]); + self.settle(); + } + + fn end_access(&mut self) { + for _ in 0..12 { + let active = egui::Popup::is_any_open(&self.ctx) + || self.cues().iter().any(|c| { + !c.popup && ["File", "Edit", "Object", "Type", "Select", "Effect", "View", "Window", "Help"].contains(&c.label.as_str()) + }); + if !active { + return; + } + self.arrow(Key::Escape); + self.settle(); + } + panic!("menu navigation did not close after bounded Escape presses"); + } + + fn advertised(&mut self, label: &str, invoke: bool) { + let cues = self.cues(); + let matches: Vec<_> = cues.iter().filter(|c| c.popup && c.label == label).collect(); + assert_eq!(matches.len(), 1, "one painted access cue for {label:?}: {cues:?}; {}", self.menu_diagnostic()); + let c = matches[0].character; + let text = c.to_lowercase().collect::(); + let key = Key::from_name(&c.to_uppercase().collect::()).expect("this English menu has a native letter key"); + // A painted letter need not be unique. Follow the advertised collision interaction, + // checking the real focused row, instead of assuming the first press names this label. + let bound = cues.iter().filter(|cue| cue.popup && cue.character.to_lowercase().eq(c.to_lowercase())).count() + 1; + for _ in 0..bound { + self.letter(key, &text, Modifiers::NONE); + self.settle(); + if !egui::Popup::is_any_open(&self.ctx) { + assert!(invoke, "submenu {label:?} must focus rather than invoke another command; {}", self.menu_diagnostic()); + return; + } + if focused_label(self, &[label]).as_deref() == Some(label) { + if invoke { + self.arrow(Key::Enter); + self.settle(); + } + return; + } + } + panic!("painted access key could not focus {label:?}; {}", self.menu_diagnostic()); + } + + fn command_from_menu(&mut self, id: &str) { + let entries = vectorcraft_ui_egui::menus::menu_entries(&self.app); + let matches: Vec<_> = entries.iter().filter(|e| e.command.as_deref() == Some(id)).collect(); + assert_eq!(matches.len(), 1, "unambiguous existing menu command {id}"); + let row = matches[0]; + let (path, label) = (row.path.clone(), row.label.clone()); + assert!(row.enabled); + self.root(&path[0]); + for submenu in path.iter().skip(1) { + self.advertised(submenu, false); + self.arrow(Key::ArrowRight); + self.settle(); + } + self.advertised(&label, true); + } + + fn assert_root_contents(&self, root: &str) { + use vectorcraft_ui_egui::menus::{self, Entry}; + let tree = menus::menu_tree_named(self.app.session.prefs.font_names_in_english); + let (_, items) = tree.iter().find(|(title, _)| *title == root).unwrap(); + let labels: Vec<_> = items + .iter() + .filter_map(|item| match menus::entry(&self.app, item)? { + Entry::Sub(label, _) => Some(label.to_string()), + Entry::Item(row) => Some(row.label.to_string()), + _ => None, + }) + .take(3) + .collect(); + assert!(!labels.is_empty()); + for label in labels { + assert!( + self.shown.iter().any(|(text, point)| clean_label(text) == label + && self.ctx.layer_id_at(*point).is_some_and(|layer| layer.order == egui::Order::Foreground)), + "visible {root} popup must contain {label:?}" + ); + } + } +} + +#[test] +fn menu_access_all_roots_bare_alt_and_one_existing_command() { + let _global = GlobalState::new(); + let mut s = Scene::new(); + let before = s.app.session.active().unwrap(); + let (doc, selection, undo) = (before.doc.clone(), before.selection.clone(), before.history.undo.len()); + s.bare_alt(); + let roots = [ + ("File", 'F'), + ("Edit", 'E'), + ("Object", 'O'), + ("Type", 'T'), + ("Select", 'S'), + ("Effect", 'C'), + ("View", 'V'), + ("Window", 'W'), + ("Help", 'H'), + ]; + let cues = s.cues(); + for (label, letter) in roots { + assert!(cues.iter().any(|c| !c.popup && c.label == label && c.character.eq_ignore_ascii_case(&letter)), "painted root cue {label}/{letter}"); + } + s.bare_alt(); + assert!(!s.cues().iter().any(|c| roots.iter().any(|(title, _)| c.label == *title))); + for (title, _) in roots { + s.root(title); + s.assert_root_contents(title); + s.end_access(); + } + let rulers = s.app.ui.view.rulers; + s.command_from_menu("view.rulers"); + assert_eq!(s.app.ui.view.rulers, !rulers, "one menu activation toggles once"); + s.settle(); + assert_eq!(s.app.ui.view.rulers, !rulers, "idle passes cannot repeat the command"); + let after = s.app.session.active().unwrap(); + assert_eq!(after.doc, doc); + assert_eq!(after.selection, selection); + assert_eq!(after.history.undo.len(), undo); +} + +#[test] +fn menu_access_localized_latin_and_cyrillic_painted_text_pairs() { + let _global = GlobalState::new(); + let mut s = Scene::new(); + for (locale, expected) in [("fr", "Fichier"), ("ru", "Файл")] { + s.app.run("app.language", json!({"lang": locale})).unwrap(); + i18n::set_current(i18n::Lang::from_code(locale).unwrap()); + s.settle(); + assert_eq!(s.app.session.prefs.interface_language, locale); + assert_eq!(s.app.ui_language().code(), locale); + s.bare_alt(); + let cues = s.cues(); + let cue = cues + .iter() + .find(|c| !c.popup && c.label == expected) + .unwrap_or_else(|| panic!("translated {locale} File root {expected:?} has no visible cue: {cues:?}; {}", s.menu_diagnostic())); + assert!(expected.chars().any(|c| c.to_lowercase().eq(cue.character.to_lowercase())), "cue is an actual translated character"); + let text = cue.character.to_lowercase().collect::(); + // Standard Russian physical positions send these Latin Key values with Cyrillic Text. + // Inter's bundled cmap contains every glyph of Файл; no substituted ASCII label is used. + let key = if locale == "ru" { + match text.as_str() { + "ф" => Key::A, + "а" => Key::F, + "й" => Key::Q, + "л" => Key::K, + _ => panic!("unexpected File cue {text}"), + } + } else { + Key::from_name(&text.to_uppercase()).unwrap() + }; + s.letter(key, &text, Modifiers::NONE); + s.settle(); + s.assert_root_contents("File"); + // Escape must end localized navigation too, independently of English labels. + for _ in 0..3 { + s.arrow(Key::Escape); + } + s.settle(); + assert!(!egui::Popup::is_any_open(&s.ctx)); + assert!(s.app.ui.dialog.is_none(), "one Text/Key pair opens only the root"); + } +} + +fn focused_label(s: &Scene, labels: &[&str]) -> Option { + let focused = s.ctx.memory(|m| m.focused())?; + let response = s.ctx.read_response(focused)?; + s.shown + .iter() + .find(|(text, point)| labels.contains(&clean_label(text)) && response.rect.contains(*point)) + .map(|(text, _)| clean_label(text).into()) +} + +#[test] +fn menu_access_disabled_rows_dynamic_collisions_and_deleted_focus() { + let _global = GlobalState::new(); + let mut s = Scene::new(); + s.app.run("select.set", json!({"ids": []})).unwrap(); + let doc = s.app.session.active().unwrap().doc.clone(); + s.root("Object"); + s.letter(Key::P, "p", Modifiers::NONE); + s.arrow(Key::ArrowRight); + s.letter(Key::O, "o", Modifiers::NONE); + s.settle(); + assert!(s.app.ui.dialog.is_none(), "disabled Offset Path cannot be invoked by its access key"); + assert_eq!(s.app.session.active().unwrap().doc, doc); + s.end_access(); + + let first = s.app.run("shape.rectangle", json!({"x": 220, "y": 70, "width": 30, "height": 40})).unwrap()["id"].clone(); + s.app.run("select.set", json!({"ids": [first]})).unwrap(); + let selection_a = s.app.session.active().unwrap().selection.clone(); + s.app.run("select.save", json!({"name": "QQQQ"})).unwrap(); + let second = s.app.run("shape.rectangle", json!({"x": 290, "y": 90, "width": 40, "height": 30})).unwrap()["id"].clone(); + s.app.run("select.set", json!({"ids": [second]})).unwrap(); + let selection_b = s.app.session.active().unwrap().selection.clone(); + s.app.run("select.save", json!({"name": "QQQ"})).unwrap(); + s.app.run("select.set", json!({"ids": []})).unwrap(); + let empty = s.app.session.active().unwrap().selection.clone(); + s.root("Select"); + let cues = s.cues(); + for label in ["QQQQ", "QQQ"] { + assert!( + cues.iter().any(|c| c.popup && c.label == label && c.character.eq_ignore_ascii_case(&'Q')), + "the unavoidable {label} collision is visibly advertised" + ); + } + s.letter(Key::Q, "q", Modifiers::NONE); + s.settle(); + let first_focus = focused_label(&s, &["QQQQ", "QQQ"]).expect("collision focuses one saved selection"); + assert_eq!(s.app.session.active().unwrap().selection, empty, "a collision letter does not execute"); + s.letter(Key::Q, "q", Modifiers::NONE); + s.settle(); + let next_focus = focused_label(&s, &["QQQQ", "QQQ"]).unwrap(); + assert_ne!(first_focus, next_focus, "repeated letter cycles the two real dynamic rows"); + s.arrow(Key::Enter); + s.settle(); + assert_eq!(s.app.session.active().unwrap().selection, if next_focus == "QQQQ" { selection_a } else { selection_b }); + + s.app.run("select.set", json!({"ids": []})).unwrap(); + s.root("Select"); + for _ in 0..2 { + s.letter(Key::Q, "q", Modifiers::NONE); + s.settle(); + if focused_label(&s, &["QQQQ", "QQQ"]).as_deref() == Some("QQQQ") { + break; + } + } + assert_eq!(focused_label(&s, &["QQQQ", "QQQ"]).as_deref(), Some("QQQQ")); + s.app.run("select.editSaved", json!({"name": "QQQQ", "delete": true})).unwrap(); + s.settle(); + assert!(!s.shown.iter().any(|(text, _)| clean_label(text) == "QQQQ")); + s.arrow(Key::Enter); + s.settle(); + assert_eq!(s.app.session.active().unwrap().selection, empty, "deleting the focused row cannot invoke the next saved-selection slot"); + assert!(s.app.ui.dialog.is_none()); +} + +fn field_range(s: &Scene, id: egui::Id) -> egui::text::CCursorRange { + egui::TextEdit::load_state(&s.ctx, id).unwrap().cursor.char_range().unwrap() +} + +impl Scene { + fn focus_numeric(&mut self) -> egui::Id { + // Unit::format includes its suffix; choose an actual original rectangle field by its number. + let mut candidates: Vec<_> = self + .shown + .iter() + .filter(|(text, _)| text.split_whitespace().next().is_some_and(|number| ["70", "60", "120", "80"].contains(&number))) + .map(|(_, p)| *p) + .collect(); + candidates.sort_by(|a, b| a.y.total_cmp(&b.y).then(a.x.total_cmp(&b.x))); + candidates.dedup(); + for point in candidates { + self.click(point); + if let Some(field) = self.ctx.memory(|m| m.focused()).filter(|id| egui::TextEdit::load_state(&self.ctx, *id).is_some()) { + return field; + } + } + panic!("an actual selected-rectangle numeric field must be focusable"); + } +} + +#[test] +#[allow(deprecated)] // ImeEvent::Disabled is a supported host cancellation event in this regression. +fn menu_access_real_numeric_field_cancel_and_edit_cut_keep_art_unchanged() { + let _global = GlobalState::new(); + { + let mut ime = Scene::new(); + ime.focus_numeric(); + ime.frame(vec![Event::Ime(egui::ImeEvent::Preedit { text: "ф".into(), active_range_chars: Some(0..1) })]); + ime.bare_alt(); + assert!(!ime.cues().iter().any(|c| !c.popup && c.label == "File"), "active composition keeps Alt ownership"); + ime.frame(vec![Event::Ime(egui::ImeEvent::Disabled)]); + ime.settle(); + ime.root("Object"); + ime.letter(Key::P, "p", Modifiers::NONE); + ime.arrow(Key::ArrowRight); + ime.letter(Key::O, "o", Modifiers::NONE); + ime.settle(); + ime.assert_offset_dialog(); // No Commit was sent: terminal cancellation really releases the latch. + } + let mut s = Scene::new(); + // These are the original rectangle's actual Transform/Control numeric fields, not a test UI. + let field = s.focus_numeric(); + s.arrow(Key::Home); + s.arrow(Key::ArrowRight); + let caret = field_range(&s, field); + assert!(caret.is_empty()); + let state = s.app.session.active().unwrap(); + let (doc, selection, undo) = (state.doc.clone(), state.selection.clone(), state.history.undo.len()); + s.bare_alt(); + s.arrow(Key::Escape); + s.settle(); + assert_eq!(s.ctx.memory(|m| m.focused()), Some(field), "cancelling access mode restores the former field"); + assert_eq!(field_range(&s, field), caret, "the original caret is restored too"); + s.bare_alt(); + let altgr = Modifiers { ctrl: true, alt: true, ..Modifiers::NONE }; + s.frame(vec![Event::ModifiersChanged(altgr), Event::Text("ø".into())]); + s.frame(vec![Event::ModifiersChanged(Modifiers::NONE)]); + s.settle(); + assert_eq!(s.ctx.memory(|m| m.focused()), Some(field), "Text-only AltGr restores the original field before delivery"); + assert_eq!(field_range(&s, field).primary.index, caret.primary.index + 1, "the actual field receives the Unicode Text event without a Key event"); + assert!(!s.cues().iter().any(|c| !c.popup && c.label == "File"), "AltGr cancels active menu mode"); + s.arrow(Key::Home); + s.frame(vec![Event::ModifiersChanged(Modifiers::SHIFT), key(Key::End, true, Modifiers::SHIFT)]); + s.frame(vec![key(Key::End, false, Modifiers::SHIFT), Event::ModifiersChanged(Modifiers::NONE)]); + assert!(!field_range(&s, field).is_empty()); + s.command_from_menu("edit.cut"); + s.settle(); + assert_eq!(s.ctx.memory(|m| m.focused()), Some(field), "Edit Cut is delivered to the original field"); + let cut = field_range(&s, field); + assert_eq!( + (cut.primary.index, cut.secondary.index), + (egui::text::CharIndex::ZERO, egui::text::CharIndex::ZERO), + "the selected numeric text was cut" + ); + let state = s.app.session.active().unwrap(); + assert_eq!(state.doc, doc, "cutting uncommitted field text must not cut selected artwork"); + assert_eq!(state.selection, selection); + assert_eq!(state.history.undo.len(), undo); + s.letter(Key::Num9, "9", Modifiers::NONE); + s.letter(Key::Num5, "5", Modifiers::NONE); + assert_eq!(field_range(&s, field).primary.index, egui::text::CharIndex(2), "normal Text/Key input resumes in the same field after menu editing"); +} + +struct KeymapRestore(vectorcraft_ui_egui::UiState); + +impl Drop for KeymapRestore { + fn drop(&mut self) { + vectorcraft_ui_egui::shortcut_editor::sync(&self.0); + } +} + +#[test] +fn menu_access_custom_shortcut_typing_tool_altgr_and_cancel_ownership() { + let _global = GlobalState::new(); + let mut s = Scene::new(); + let _restore = KeymapRestore(s.app.ui.clone()); + let rulers = s.app.ui.view.rulers; + s.app.run("shortcuts.set", json!({"id": "view.rulers", "shortcut": "Alt+O"})).unwrap(); + s.root("Object"); + let once = s.app.ui.view.rulers; + let open = egui::Popup::is_any_open(&s.ctx); + s.app.run("shortcuts.set", json!({"id": "view.rulers", "shortcut": null})).unwrap(); + assert_eq!(once, !rulers, "the user's existing Alt+O shortcut wins"); + assert!(!open, "the same chord must not also arm Object"); + + s.letter(Key::P, "p", Modifiers::NONE); + assert_eq!(s.app.session.tool_id(), "pen", "ordinary typing tool shortcut still works"); + s.app.select_tool("selection"); + let altgr = Modifiers { ctrl: true, alt: true, ..Modifiers::NONE }; + s.frame(vec![Event::ModifiersChanged(altgr)]); + s.letter(Key::O, "ø", altgr); + s.frame(vec![Event::ModifiersChanged(Modifiers::NONE)]); + s.settle(); + assert!(!egui::Popup::is_any_open(&s.ctx)); + assert!(!s.cues().iter().any(|c| !c.popup && c.label == "Object"), "Ctrl+Alt/AltGr does not become bare Alt navigation"); + + s.bare_alt(); + s.window_focus(false); + s.window_focus(true); + s.settle(); + assert!(!s.cues().iter().any(|c| !c.popup && c.label == "File"), "window focus loss cancels access mode"); + s.bare_alt(); + s.click(Pos2::new(1000.0, 850.0)); + assert!(!s.cues().iter().any(|c| !c.popup && c.label == "File"), "an outside pointer click cancels access mode"); + for key_id in [Key::Tab, Key::Space] { + s.frame(vec![Event::ModifiersChanged(Modifiers::ALT), key(key_id, true, Modifiers::ALT)]); + s.frame(vec![key(key_id, false, Modifiers::ALT), Event::ModifiersChanged(Modifiers::NONE)]); + s.settle(); + assert!(!s.cues().iter().any(|c| !c.popup && c.label == "File"), "Alt+Tab/Space does not become an unused Alt release"); + } + s.app.select_tool("rectangle"); + // Ordinary points inside the wide fixture's real central canvas: use the actual App pointer + // route, with a busy-tool precondition, rather than merely selecting an idle tool. + let (start, end) = (Pos2::new(600.0, 500.0), Pos2::new(650.0, 540.0)); + s.frame(vec![ + Event::ModifiersChanged(Modifiers::ALT), + Event::PointerMoved(start), + Event::PointerButton { pos: start, button: PointerButton::Primary, pressed: true, modifiers: Modifiers::ALT }, + ]); + s.frame(vec![Event::PointerMoved(end)]); + assert!(s.app.session.tool_busy(), "the actual rectangle drag must have started"); + s.bare_alt(); + assert_eq!(s.app.session.tool_id(), "rectangle"); + assert!(s.app.session.tool_busy(), "Alt access cannot finish or replace the active gesture"); + assert!(!s.cues().iter().any(|c| !c.popup && c.label == "File")); + s.frame(vec![Event::PointerButton { pos: end, button: PointerButton::Primary, pressed: false, modifiers: Modifiers::NONE }]); + s.settle(); + assert!(!s.app.session.tool_busy(), "normal pointer release completes the same gesture"); + assert!(!s.cues().iter().any(|c| !c.popup && c.label == "File"), "using Alt with the pointer cannot arm a later unused-Alt release"); + s.app.select_tool("selection"); + s.app.run("select.all", json!({})).unwrap(); + s.command_from_menu("object.path.offsetPath"); + s.assert_offset_dialog(); + s.root("Edit"); + assert_eq!(s.app.ui.dialog.as_ref().unwrap().kind, "offsetPath", "an existing modal dialog keeps keyboard ownership"); + assert!(!s.cues().iter().any(|c| !c.popup && c.label == "Edit")); +} + +#[test] +fn menu_access_stationary_pointer_repeat_and_rerun_do_not_retarget_or_double_invoke() { + let _global = GlobalState::new(); + let mut s = Scene::new(); + let object = s.point("Object", false); + s.frame(vec![Event::PointerMoved(object)]); + s.root("File"); + s.assert_root_contents("File"); + s.settle(); + s.assert_root_contents("File"); + s.frame(vec![Event::PointerMoved(s.point("Edit", false))]); + s.settle(); + s.assert_root_contents("Edit"); + s.end_access(); + s.frame(vec![Event::PointerGone]); + s.root("Object"); + s.frame(vec![ + Event::ModifiersChanged(Modifiers::ALT), + Event::Key { key: Key::O, physical_key: Some(Key::O), pressed: true, repeat: true, modifiers: Modifiers::ALT }, + Event::Text("o".into()), + ]); + s.frame(vec![key(Key::O, false, Modifiers::ALT), Event::ModifiersChanged(Modifiers::NONE)]); + s.settle(); + s.assert_root_contents("Object"); + s.end_access(); + + let entries = vectorcraft_ui_egui::menus::menu_entries(&s.app); + let row = entries.iter().find(|e| e.command.as_deref() == Some("view.rulers")).unwrap(); + let (path, label) = (row.path.clone(), row.label.clone()); + s.root(&path[0]); + for submenu in path.iter().skip(1) { + s.advertised(submenu, false); + s.arrow(Key::ArrowRight); + s.settle(); + } + let cues = s.cues(); + let cue = cues + .iter() + .find(|c| c.popup && c.label == label) + .unwrap_or_else(|| panic!("rerun command {label:?} has no painted cue: {cues:?}; {}", s.menu_diagnostic())); + let text = cue.character.to_lowercase().collect::(); + let key_id = Key::from_name(&text.to_uppercase()).unwrap(); + let before = s.app.ui.view.rulers; + s.time += 1.0 / 30.0; + let mut raw = RawInput { + time: Some(s.time), + screen_rect: Some(Rect::from_min_size(Pos2::ZERO, vec2(1440.0, 1000.0))), + events: vec![Event::ModifiersChanged(Modifiers::NONE), key(key_id, true, Modifiers::NONE), Event::Text(text)], + ..Default::default() + }; + s.app.raw_input_hook(&s.ctx, &mut raw); + let mut passes = 0; + let mut out = s.ctx.run_ui(raw, |ui| { + passes += 1; + s.app.ui(ui); + if passes == 1 { + ui.ctx().request_discard("exercise the real App's once-per-frame menu input"); + } + }); + out.textures_delta.clear(); + s.frame(vec![key(key_id, false, Modifiers::NONE)]); + s.settle(); + assert!(passes >= 2, "the test must actually exercise a UI rerun"); + assert_eq!(s.app.ui.view.rulers, !before, "one Text/Key pair invokes exactly once across passes"); + + s.end_access(); + let text = s.app.run("text.create", json!({"x": 250, "y": 200, "text": "Menu", "font": "Inter", "size": 12})).unwrap()["id"].clone(); + s.app.run("select.set", json!({"ids": [text]})).unwrap(); + let size = vec2(640.0, 420.0); + for _ in 0..4 { + s.at_size(vec![], size); + } + s.at_size(vec![Event::ModifiersChanged(Modifiers::ALT), key(Key::T, true, Modifiers::ALT), Event::Text("t".into())], size); + s.at_size(vec![key(Key::T, false, Modifiers::ALT), Event::ModifiersChanged(Modifiers::NONE)], size); + let cues = s.at_size(vec![], size); + let font = cues.iter().find(|c| c.popup && c.label == "Font").expect("narrow Type menu exposes its Font submenu"); + let letter = font.character.to_lowercase().collect::(); + let font_key = Key::from_name(&letter.to_uppercase()).unwrap(); + s.at_size(vec![key(font_key, true, Modifiers::NONE), Event::Text(letter)], size); + s.at_size(vec![key(font_key, false, Modifiers::NONE)], size); + s.at_size(vec![key(Key::ArrowRight, true, Modifiers::NONE)], size); + s.at_size(vec![key(Key::ArrowRight, false, Modifiers::NONE)], size); + let entries = vectorcraft_ui_egui::menus::menu_entries(&s.app); + let font_labels: Vec<_> = entries + .iter() + .filter(|e| { + e.path.first().is_some_and(|p| p == "Type") && e.path.iter().any(|p| p == "Font") && e.command.as_deref() == Some("text.setStyle") + }) + .map(|e| e.label.clone()) + .collect(); + assert!(font_labels.len() > 20, "the inherited bundled font fixture must produce a genuinely long submenu"); + let first = s.ctx.memory(|m| m.focused()).expect("Font navigation has a genuine focused menu response"); + let viewport = Rect::from_min_size(Pos2::ZERO, size); + // Right can leave global focus on the Font parent until native Down navigation enters its + // children. Locate the pointer from an actually painted family cue instead of that parent. + let family_cues = s.at_size(vec![], size); + let (pointer_family, pointer, wheel_layer) = s + .shown + .iter() + .filter_map(|(text, point)| { + let label = clean_label(text); + if !font_labels.iter().any(|family| family == label) || !family_cues.iter().any(|cue| cue.popup && cue.label == label) { + return None; + } + let layer = s.ctx.layer_id_at(*point)?; + (layer.order == egui::Order::Foreground).then_some((label.to_owned(), *point, layer)) + }) + .min_by(|a, b| a.1.y.total_cmp(&b.1.y).then(a.1.x.total_cmp(&b.1.x))) + .unwrap_or_else(|| panic!("wheel precondition requires an actual painted Font family: {family_cues:?}; {}", s.menu_diagnostic())); + assert!( + viewport.contains(pointer) && s.ctx.layer_id_at(pointer) == Some(wheel_layer), + "wheel point for {pointer_family:?} is inside the actual visible Font popup" + ); + s.at_size(vec![Event::PointerMoved(pointer)], size); + let focus_before_rearm = s.ctx.memory(|m| m.focused()); + // Movement alone already gives the old implementation pointer ownership. A real navigation + // key must re-arm keyboard ownership with that pointer stationary INSIDE the same popup. + s.at_size(vec![key(Key::ArrowDown, true, Modifiers::NONE)], size); + s.at_size(vec![key(Key::ArrowDown, false, Modifiers::NONE)], size); + s.at_size(vec![], size); + let rearmed_focus = s.ctx.memory(|m| m.focused()).expect("real Down navigation retains menu focus"); + assert_ne!(Some(rearmed_focus), focus_before_rearm, "the real re-arming Down press advances Font focus before the wheel"); + let rearmed_row = s.ctx.read_response(rearmed_focus).unwrap(); + assert!( + s.shown.iter().any(|(text, point)| font_labels.contains(&clean_label(text).to_owned()) + && rearmed_row.rect.contains(*point) + && s.ctx.layer_id_at(*point) == Some(wheel_layer)), + "re-armed keyboard focus remains on a visible Font family in the same popup" + ); + assert_eq!(s.ctx.pointer_hover_pos(), Some(pointer)); + assert_eq!(s.ctx.layer_id_at(pointer), Some(wheel_layer)); + let top_family = |scene: &Scene, labels: &[String]| { + scene + .shown + .iter() + .filter(|(text, point)| labels.contains(&clean_label(text).to_owned()) && scene.ctx.layer_id_at(*point) == Some(wheel_layer)) + .map(|(text, point)| (clean_label(text).to_owned(), *point)) + .min_by(|a, b| a.1.y.total_cmp(&b.1.y).then(a.1.x.total_cmp(&b.1.x))) + .expect("the real Font popup has a visible top family") + }; + let wheel_top_before = top_family(&s, &font_labels); + let wheel_state = s.app.session.active().unwrap(); + let (wheel_doc, wheel_selection, wheel_history) = + (wheel_state.doc.clone(), wheel_state.selection.clone(), (wheel_state.history.undo.len(), wheel_state.history.redo.len())); + s.at_size( + vec![Event::MouseWheel { + unit: egui::MouseWheelUnit::Point, + delta: vec2(0.0, -80.0), + phase: egui::TouchPhase::Move, + source: egui::MouseWheelSource::Unknown, + modifiers: Modifiers::NONE, + }], + size, + ); + for _ in 0..10 { + s.at_size(vec![], size); + } + let wheel_top_after = top_family(&s, &font_labels); + let before_index = font_labels.iter().position(|label| label == &wheel_top_before.0).unwrap(); + let after_index = font_labels.iter().position(|label| label == &wheel_top_after.0).unwrap(); + assert!( + after_index > before_index || (wheel_top_after.0 == wheel_top_before.0 && wheel_top_after.1.y < wheel_top_before.1.y - 1.0), + "stationary raw wheel must scroll the real Font list after keyboard navigation: before={wheel_top_before:?}, after={wheel_top_after:?}" + ); + assert!(s.app.ui.dialog.is_none(), "wheel scroll cannot invoke a menu command"); + let wheel_state = s.app.session.active().unwrap(); + assert_eq!(wheel_state.doc, wheel_doc); + assert_eq!(wheel_state.selection, wheel_selection); + assert_eq!((wheel_state.history.undo.len(), wheel_state.history.redo.len()), wheel_history); + for _ in 0..20 { + s.at_size(vec![key(Key::ArrowDown, true, Modifiers::NONE)], size); + s.at_size(vec![key(Key::ArrowDown, false, Modifiers::NONE)], size); + } + let focus_before_settle = s.ctx.memory(|m| m.focused()).unwrap(); + // The normal scroll animation can take 0.3s. Keep the actual narrow viewport while it settles. + for _ in 0..10 { + s.at_size(vec![], size); + } + let cues = s.at_size(vec![], size); + let focus = s.ctx.memory(|m| m.focused()).unwrap(); + assert_eq!(focus, focus_before_settle, "settling scrolling must not change the chosen Font row"); + assert_ne!(focus, first, "normal Down navigation advances through the long submenu"); + // An installed-font scan can finish while the menu is open; compare with its current rows. + let entries = vectorcraft_ui_egui::menus::menu_entries(&s.app); + let font_labels: Vec<_> = entries + .iter() + .filter(|e| { + e.path.first().is_some_and(|p| p == "Type") && e.path.iter().any(|p| p == "Font") && e.command.as_deref() == Some("text.setStyle") + }) + .map(|e| e.label.clone()) + .collect(); + let response = s.ctx.read_response(focus).unwrap(); + let viewport = Rect::from_min_size(Pos2::ZERO, size); + assert!( + viewport.contains(response.rect.center()), + "the focused row must scroll into the actual narrow viewport: focus={focus:?}, rect={:?}, viewport={viewport:?}, visible_fonts={:?}", + response.rect, + s.shown.iter().filter(|(text, _)| font_labels.contains(&clean_label(text).to_owned())).take(8).collect::>() + ); + assert!( + cues.iter().any(|c| c.popup + && font_labels.contains(&c.label) + && s.shown.iter().any(|(text, point)| clean_label(text) == c.label && response.rect.contains(*point))), + "the scrolled focused Font row retains a visible painted access cue" + ); +} + +/// The reported Select menu letters use the actual name/list dialog routes, +/// with no document edit before a normal dialog confirmation. +#[test] +fn menu_access_select_save_and_edit_use_reported_letters() { + let _global = GlobalState::new(); + let mut s = Scene::new(); + let before = s.app.session.active().unwrap(); + let (doc, selection) = (before.doc.clone(), before.selection.clone()); + let history = (before.history.undo.len(), before.history.redo.len()); + s.root("Select"); + s.letter(Key::S, "s", Modifiers::NONE); + s.settle(); + let dialog = s.app.ui.dialog.as_ref().expect("Alt+S then S must open Save Selection, not focus Same"); + assert_eq!(dialog.kind, "command"); + assert_eq!(dialog.str("__command"), "select.save"); + assert_eq!(dialog.str("__label"), "Save Selection"); + assert_eq!(dialog.str("name"), "Selection 1"); + assert!(s.shown.iter().any(|(text, _)| text == "Save Selection"), "the real naming dialog must be drawn"); + let after = s.app.session.active().unwrap(); + assert_eq!(after.doc, doc, "opening Save Selection does not edit art or saved selections"); + assert_eq!(after.selection, selection); + assert_eq!((after.history.undo.len(), after.history.redo.len()), history); + vectorcraft_ui_egui::dialogs::cancel(&mut s.app); + s.settle(); + s.end_access(); + assert!(s.app.ui.dialog.is_none()); + let after_cancel = s.app.session.active().unwrap(); + assert_eq!(after_cancel.doc, doc); + assert_eq!(after_cancel.selection, selection); + assert_eq!((after_cancel.history.undo.len(), after_cancel.history.redo.len()), history); + + // Edit Selection is enabled only after a real saved selection exists. + // This command is setup, never a substitute for the observed E invocation. + s.app.run("select.save", json!({"name": "Access Keys Selection"})).unwrap(); + s.settle(); + let before = s.app.session.active().unwrap(); + let (doc, selection) = (before.doc.clone(), before.selection.clone()); + let history = (before.history.undo.len(), before.history.redo.len()); + s.root("Select"); + s.letter(Key::E, "e", Modifiers::NONE); + s.settle(); + let dialog = s.app.ui.dialog.as_ref().expect("Alt+S then E must open Edit Selection"); + assert_eq!(dialog.kind, "editSelection"); + assert_eq!(dialog.fields["count"].as_u64(), Some(1)); + assert_eq!(dialog.str("orig0"), "Access Keys Selection"); + assert!(s.shown.iter().any(|(text, _)| text == "Edit Selection"), "the real saved-selection list must be drawn"); + let after = s.app.session.active().unwrap(); + assert_eq!(after.doc, doc, "opening Edit Selection does not rename or delete a saved selection"); + assert_eq!(after.selection, selection); + assert_eq!((after.history.undo.len(), after.history.redo.len()), history); + vectorcraft_ui_egui::dialogs::cancel(&mut s.app); + s.settle(); + s.end_access(); + assert!(s.app.ui.dialog.is_none()); + let after_cancel = s.app.session.active().unwrap(); + assert_eq!(after_cancel.doc, doc); + assert_eq!(after_cancel.selection, selection); + assert_eq!((after_cancel.history.undo.len(), after_cancel.history.redo.len()), history); +} + +// Review regressions use real App input and painted menu targets, including the native parent +// focus left by Right. The original nine cases above remain unchanged. +#[test] +fn menu_access_review_bare_alt_outside_panel_click_releases_tool_shortcuts() { + let _global = GlobalState::new(); + let mut s = Scene::new(); + let state = s.app.session.active().unwrap(); + let (doc, selection, history) = (state.doc.clone(), state.selection.clone(), (state.history.undo.len(), state.history.redo.len())); + s.bare_alt(); + assert!(s.cues().iter().any(|c| !c.popup && c.label == "File"), "bare Alt must first expose the File root cue"); + assert!(!egui::Popup::is_any_open(&s.ctx), "this is closed access mode, not an open popup"); + // The actual Layers tab/header is panel chrome. Unlike the earlier canvas click, this + // cannot accidentally satisfy cancellation by starting a busy drawing/selection gesture. + let header = s.point("Layers", false); + assert!(header.y > 40.0, "the actual Layers header is outside the main menu bar"); + s.click(header); + assert!(!s.app.session.tool_busy(), "the non-canvas header click must leave the tool idle"); + assert!(!s.cues().iter().any(|c| !c.popup && c.label == "File"), "an outside panel click must cancel even closed access mode"); + assert!(!egui::Popup::is_any_open(&s.ctx)); + assert!(s.app.ui.dialog.is_none()); + let state = s.app.session.active().unwrap(); + assert_eq!(state.doc, doc); + assert_eq!(state.selection, selection); + assert_eq!((state.history.undo.len(), state.history.redo.len()), history); + s.letter(Key::P, "p", Modifiers::NONE); + assert_eq!(s.app.session.tool_id(), "pen", "ordinary P must reach the tool shortcut after panel dismissal"); + assert!(!egui::Popup::is_any_open(&s.ctx), "the same P must not navigate a menu"); + assert!(s.app.ui.dialog.is_none()); +} + +#[test] +fn menu_access_review_font_mnemonic_after_right_uses_open_child_level() { + let _global = GlobalState::new(); + let mut s = Scene::new(); + let id = s.app.run("text.create", json!({"x": 250, "y": 200, "text": "Menu", "font": "Inter", "size": 12})).unwrap()["id"].as_u64().unwrap(); + s.app.run("select.set", json!({"ids": [id]})).unwrap(); + s.settle(); + let font_rows = |scene: &Scene| { + vectorcraft_ui_egui::menus::menu_entries(&scene.app) + .into_iter() + .filter(|e| { + e.path.first().is_some_and(|p| p == "Type") && e.path.iter().any(|p| p == "Font") && e.command.as_deref() == Some("text.setStyle") + }) + .map(|e| (e.label, e.params["font"].as_str().expect("Font family rows supply the canonical family").to_owned())) + .collect::>() + }; + let family = |scene: &Scene| { + let node = scene.app.session.active().unwrap().doc.node(vectorcraft_doc::NodeId(id)).unwrap(); + let vectorcraft_doc::NodeKind::Text(text) = &node.kind else { panic!("the selected original object remains text") }; + text.runs.first().unwrap().style.font_family.clone() + }; + let initial_rows = font_rows(&s); + assert!(initial_rows.len() > 1, "the inherited font fixture has distinct real families"); + // Set a real family from the end of the same public menu, so its first row can make a + // meaningful font change without guessing a host-installed family or a private font API. + let initial = initial_rows.last().unwrap().1.clone(); + s.app.run("text.setStyle", json!({"font": initial})).unwrap(); + s.settle(); + let before = family(&s); + let selection = s.app.session.active().unwrap().selection.clone(); + let history = s.app.session.active().unwrap().history.undo.len(); + let size = vec2(640.0, 420.0); + for _ in 0..4 { + s.at_size(vec![], size); + } + let pointer = s.ctx.pointer_hover_pos(); + // Match the existing narrow-menu witness exactly; the wide Scene convenience methods + // would reset the viewport and could change egui's Right/focus transition. + s.at_size(vec![Event::ModifiersChanged(Modifiers::ALT), key(Key::T, true, Modifiers::ALT), Event::Text("t".into())], size); + s.at_size(vec![key(Key::T, false, Modifiers::ALT), Event::ModifiersChanged(Modifiers::NONE)], size); + let type_cues = s.at_size(vec![], size); + let font_cue = type_cues.iter().find(|c| c.popup && c.label == "Font").expect("the actual narrow Type menu exposes Font"); + let font_text = font_cue.character.to_lowercase().collect::(); + let font_key = Key::from_name(&font_cue.character.to_uppercase().collect::()).unwrap(); + s.at_size(vec![key(font_key, true, Modifiers::NONE), Event::Text(font_text)], size); + s.at_size(vec![key(font_key, false, Modifiers::NONE)], size); + s.at_size(vec![key(Key::ArrowRight, true, Modifiers::NONE)], size); + s.at_size(vec![key(Key::ArrowRight, false, Modifiers::NONE)], size); + // No Down and no pointer movement: this is the actual parent-focus state the former + // long-menu test skipped before switching to pointer/wheel interaction. + let cues = s.at_size(vec![], size); + // Exercise the actual Right transition without forcing global focus onto its parent. + // The unchanged implementation already focuses a family in this native App route. + assert_eq!(s.ctx.pointer_hover_pos(), pointer, "opening Font and choosing its letter use keyboard input only"); + let rows = font_rows(&s); + let (label, expected) = rows.first().expect("the open Font list has an actual first family").clone(); + assert_ne!(before, expected, "the chosen family must actually change the text's font"); + let target = s.point(&label, true); + assert!(Rect::from_min_size(Pos2::ZERO, size).contains(target), "the first real family is visible"); + let cue = cues.iter().find(|c| c.popup && c.label == label).expect("the actual visible family advertises its mnemonic"); + let text = cue.character.to_lowercase().collect::(); + let key_id = Key::from_name(&cue.character.to_uppercase().collect::()).expect("the English family cue has a native key"); + s.at_size(vec![Event::ModifiersChanged(Modifiers::NONE), key(key_id, true, Modifiers::NONE), Event::Text(text)], size); + s.at_size(vec![key(key_id, false, Modifiers::NONE)], size); + for _ in 0..3 { + s.at_size(vec![], size); + } + assert!(s.app.ui.dialog.is_none(), "a family letter cannot invoke a command from the parent Type level"); + if family(&s) != expected { + // A shared cue selects the first matching row and requires Enter. The first family + // is also the first possible match; never substitute Down or pointer selection. + assert_eq!( + focused_label(&s, &[label.as_str()]), + Some(label.clone()), + "the delivered family mnemonic must focus inside Font, not Type: {}", + s.menu_diagnostic() + ); + s.at_size(vec![key(Key::Enter, true, Modifiers::NONE)], size); + s.at_size(vec![key(Key::Enter, false, Modifiers::NONE)], size); + for _ in 0..3 { + s.at_size(vec![], size); + } + } + assert_eq!(family(&s), expected, "the advertised child mnemonic must apply its real text.setStyle target"); + assert_eq!(s.app.session.active().unwrap().selection, selection); + assert_eq!(s.app.session.active().unwrap().history.undo.len(), history + 1, "one family choice makes one font edit"); + assert!(!egui::Popup::is_any_open(&s.ctx)); + assert!(s.app.ui.dialog.is_none()); +} + +#[test] +fn menu_access_review_fresh_alt_reselects_root_from_open_submenu() { + let _global = GlobalState::new(); + for pointer_movement in [true, false] { + let mut s = Scene::new(); + if pointer_movement { + // Establish a real previous position before opening the menus, so the later movement + // is nonzero rather than the pointer's first appearance. + s.frame(vec![Event::PointerMoved(s.point("Layers", false))]); + s.settle(); + } + let state = s.app.session.active().unwrap(); + let (doc, selection, history) = (state.doc.clone(), state.selection.clone(), (state.history.undo.len(), state.history.redo.len())); + s.root("Object"); + s.letter(Key::P, "p", Modifiers::NONE); + s.arrow(Key::ArrowRight); + s.settle(); + assert!(s.cues().iter().any(|c| c.popup && c.label == "Offset Path\u{2026}"), "the actual Object > Path submenu must be open first"); + assert!(s.app.ui.dialog.is_none()); + // A fresh physical Alt chord names a top-level root even while a descendant popup is + // open; unmodified letters below still address the selected submenu normally. + if pointer_movement { + let title = s.point("Object", false); + assert_ne!(s.ctx.pointer_hover_pos(), Some(title), "the same-batch pointer must actually move"); + s.frame(vec![ + Event::ModifiersChanged(Modifiers::ALT), + Event::PointerMoved(title), + key(Key::O, true, Modifiers::ALT), + Event::Text("o".into()), + ]); + s.frame(vec![key(Key::O, false, Modifiers::ALT), Event::ModifiersChanged(Modifiers::NONE)]); + s.settle(); + } else { + s.root("Object"); + } + assert!(s.app.ui.dialog.is_none(), "fresh Alt+O must select Object, not invoke Offset Path"); + s.assert_root_contents("Object"); + assert!( + !s.shown.iter().any(|(text, point)| clean_label(text) == "Offset Path\u{2026}" + && s.ctx.layer_id_at(*point).is_some_and(|layer| layer.order == egui::Order::Foreground)), + "reselecting Object closes its old Path descendant" + ); + s.letter(Key::P, "p", Modifiers::NONE); + s.arrow(Key::ArrowRight); + s.letter(Key::O, "o", Modifiers::NONE); + s.settle(); + s.assert_offset_dialog(); + let state = s.app.session.active().unwrap(); + assert_eq!(state.doc, doc); + assert_eq!(state.selection, selection); + assert_eq!((state.history.undo.len(), state.history.redo.len()), history); + } +} diff --git a/docs/roadmap.md b/docs/roadmap.md index a28e6a30d1..6d3501faae 100644 --- a/docs/roadmap.md +++ b/docs/roadmap.md @@ -1,6 +1,6 @@ # Roadmap: milestones and what's next -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-18 · **Change:** minor (Backquote/~ arrow pattern nudges (#7717); scores and estimates unchanged; previously: Window > Toolbars > Compact Tools offers optional denser main Tools spacing (#7234); default layout, scores and estimates unchanged; previously: Direct Selection: Space during an ordinary path's handle drag repositions its anchor and handles, including a Pen loan (#7237, request 3 only; scores and estimates unchanged); previously: M4: `.ai` and EPS import: clipping paths grouped in a compound path are its subpaths, #8128; scores and estimates unchanged; previously: import: type filled and stroked by a `TJ` whose kerning starts a new line comes in filled and stroked, #8543; PDF Retype phase 1 (#4934): Type › Retype (`type.retype`) turns outlined text that exactly matches an available font back into point text; scores and estimates unchanged; previously: M1: Lock Guides: a selection marquee (Selection, Direct Selection, Group Selection, Enclosing Lasso) leaves out paths made into guides inside groups and compound paths too, as clicks do (#3074), so a group is no longer selected by a locked guide in it; an enclosing marquee measures a group without its locked or hidden guides, and Direct Selection takes no anchor or segment of a guide that can't be picked; a guide in a group still moves with its group (#8538); Production Preflight: output-aware fonts, text overflow, linked files and effective image resolution, clickable findings and automatic rechecking; scores and estimates unchanged; previously: PDF export writes the document language as the catalog's `/Lang`, #3644; M1: an Alt-drag in the Layers panel copies a row above or below its own place, #8237; scores and estimates unchanged; previously: PDF import: a glyph filled only after a glyph filled and stroked comes in filled only, not stroked, #8300; PDF import: translucent type filled and stroked comes in as a filled type object and a stroked one, as the file composites them, and an upright glyph is never kept as the outline of its glyph alone, #8015; PDF import: type filled and stroked by one text-showing operator comes in as one type object, filled and stroked, not a stroked copy over a filled one, #8015; M1: Layers panel Alt-drag shows the copy cursor, #8217; scores and estimates unchanged; previously: Gradient panel: the add-stop strip shows the white arrow with a plus on Windows and X11, #8241; scores and estimates unchanged; previously: Recolor Artwork follow-up (#8031, remaining #4028): native Lab input, picker swatch libraries and Assign-row menus; UI interaction regression coverage; scores and estimates unchanged; previously: Eraser review: hidden Rasterize and Along/Across stroke rows do not block preserving visible gradients; scores and estimates unchanged; previously: Eraser review: ordinary Group/Layer paints and reproducible evaluated gradient placements are preserved; other placements retain existing fitting; scores and estimates unchanged; previously: Eraser: shared fill-only area cutting for fixed and varied tips and the Alt-drag marquee, #6582; scores and estimates unchanged; previously: #8005: the Color spectrum fills a resized panel; scores and estimates unchanged; previously: M7: Check Spelling modal dialog (Edit › Spelling › Check Spelling…), #4936; spell check complete; previously: PDF import: stroked type keeps the line cap, line join and miter limit the file strokes it with, a glyph stroked otherwise than the run it joins coming in as a run of its own, #7741; M10/G5: Neon & Glow built-in graphic style library (Cyan Neon, Magenta Laser, Amber Tube, Electric Lime, Pulse Violet, Cobalt Phosphor); previously: Tech Circuit brush library, G5; previously: Graphic Styles list fills a taller panel, #2992; scores and estimates unchanged; previously: PDF import: glyphs in a span with an empty ActualText come in as outlines, #6971; scores and estimates unchanged; previously: library panels' lists fill a taller panel, #2992; scores and estimates unchanged; previously: Swatches list fills a taller panel, #1638; scores and estimates unchanged; previously: icon-strip flyouts also resize from the top edge and the canvas-side top corner, keeping the moved top in workspaces (storytold/craft-libs#1094); scores and estimates unchanged; previously: #6865: explicitly requested oversized editing artboard; Live Paint Bucket fills faces crossed in one drag (#6373); previously: #6404: transform-aware Eyedropper character copying; scores and estimates unchanged; previously: M10/G5: Energy Beams brush library; MCP docs list Energy Beams; previously minor: M10/G5: Skill Icons symbol library; MCP docs list Skill Icons; previously minor: M10/G5: Status Effects graphic style library; MCP docs catch-up for symbol libraries; previously minor: M10/G5: Inventory Icons built-in symbol library; previously minor: Edit › Edit Custom Dictionary…: its dialog adds, deletes and changes the custom dictionary's words, #4936; previously minor: M10/G5: Game HUD graphic style library; previously minor: resizable icon-strip flyouts and bottom-aligned panel footers, #5713; previously minor: M10/G5: Map Markers built-in symbol library; previously minor: right-click on type: Spelling › Auto Spell Check, with its check mark, #4936; previously minor: right-click on a word Auto Spell Check underlined: its suggestions, Ignore All and Add to Dictionary, #4936; previously minor: G2: Effect Gallery thumbnails and in-dialog preview are in; Auto Spell Check: `edit.autoSpellCheck` underlines the unknown words, #4936; previously minor: PDF editable import preserves authored ActualText once, including empty/nested spans and authored ordering (#6165); cross-line/style layout remains approximate; scores and estimates unchanged; PDF marked-text export (#6309): compatible glyphs stay on one layout line with per-glyph offsets; scores and estimates unchanged; interim macOS cursor delivery, #2292; native validation pending; scores and estimates unchanged; Control bar › Snapping includes the existing Snap to Glyph and Alignment Guides toggles (#6164); scores and estimates unchanged; custom dictionary and Ignore All: `text.spelling.addWord`, `removeWord`, `changeWord`, `dictionary` and `ignoreAll`, #4936; previously minor: EPS import: embedded fonts (composite, Type 42, CID-keyed, Type 1, CFF FontSet) draw their glyphs; spell check engine: `text.spelling.check` and `text.spelling.suggest` on craft-proof, #4936; previously minor: floating tab groups collapse into the side icon rail and opened rail panels fold back into it, #5925 in part; M4/M7: `.ai`/EPS type keeps its tab stops, and right-aligned lines with tabs lay out as the file's page, #6147; M4/M7: `.ai`/EPS type from the text document lays its lines out closer to the file's page, within limits, #6137; numeric fields step on wheel hover without taking keyboard focus, #5949; Character Styles panel: a double-click on a style's row opens its Character Style Options; the dialog keeps a fixed width and scrolls its sections, so its buttons stay on screen; Selection QoL: marquee modes and visible feedback, #5313; SVG CSS classes survive export and repeated import in all four styling modes (#2480); current-main integration retains event attributes and scripts; #3380 deletion-only review follow-up: independent survivors keep gradient placement, owned subpaths avoid discarded copies, and contracts/status/evidence are clarified; endpoint highlighting remains open; scores and estimates unchanged; Indian-language hyphenation review and license allowlist, #4947; Hindi catalog and contributor loanword preferences; full wording review in progress; Effect dialogs: a colour swatch beside a hex colour opens the Color Picker, #5365; shape tools move the selection from its centre point and turn it from the zone outside a box corner, #5477; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-18 · **Change:** minor (Windows/Linux menu access keys and localized cues (#6596); previously: Backquote/~ arrow pattern nudges (#7717); scores and estimates unchanged; previously: Window > Toolbars > Compact Tools offers optional denser main Tools spacing (#7234); default layout, scores and estimates unchanged; previously: Direct Selection: Space during an ordinary path's handle drag repositions its anchor and handles, including a Pen loan (#7237, request 3 only; scores and estimates unchanged); previously: M4: `.ai` and EPS import: clipping paths grouped in a compound path are its subpaths, #8128; scores and estimates unchanged; previously: import: type filled and stroked by a `TJ` whose kerning starts a new line comes in filled and stroked, #8543; PDF Retype phase 1 (#4934): Type › Retype (`type.retype`) turns outlined text that exactly matches an available font back into point text; scores and estimates unchanged; previously: M1: Lock Guides: a selection marquee (Selection, Direct Selection, Group Selection, Enclosing Lasso) leaves out paths made into guides inside groups and compound paths too, as clicks do (#3074), so a group is no longer selected by a locked guide in it; an enclosing marquee measures a group without its locked or hidden guides, and Direct Selection takes no anchor or segment of a guide that can't be picked; a guide in a group still moves with its group (#8538); Production Preflight: output-aware fonts, text overflow, linked files and effective image resolution, clickable findings and automatic rechecking; scores and estimates unchanged; previously: PDF export writes the document language as the catalog's `/Lang`, #3644; M1: an Alt-drag in the Layers panel copies a row above or below its own place, #8237; scores and estimates unchanged; previously: PDF import: a glyph filled only after a glyph filled and stroked comes in filled only, not stroked, #8300; PDF import: translucent type filled and stroked comes in as a filled type object and a stroked one, as the file composites them, and an upright glyph is never kept as the outline of its glyph alone, #8015; PDF import: type filled and stroked by one text-showing operator comes in as one type object, filled and stroked, not a stroked copy over a filled one, #8015; M1: Layers panel Alt-drag shows the copy cursor, #8217; scores and estimates unchanged; previously: Gradient panel: the add-stop strip shows the white arrow with a plus on Windows and X11, #8241; scores and estimates unchanged; previously: Recolor Artwork follow-up (#8031, remaining #4028): native Lab input, picker swatch libraries and Assign-row menus; UI interaction regression coverage; scores and estimates unchanged; previously: Eraser review: hidden Rasterize and Along/Across stroke rows do not block preserving visible gradients; scores and estimates unchanged; previously: Eraser review: ordinary Group/Layer paints and reproducible evaluated gradient placements are preserved; other placements retain existing fitting; scores and estimates unchanged; previously: Eraser: shared fill-only area cutting for fixed and varied tips and the Alt-drag marquee, #6582; scores and estimates unchanged; previously: #8005: the Color spectrum fills a resized panel; scores and estimates unchanged; previously: M7: Check Spelling modal dialog (Edit › Spelling › Check Spelling…), #4936; spell check complete; previously: PDF import: stroked type keeps the line cap, line join and miter limit the file strokes it with, a glyph stroked otherwise than the run it joins coming in as a run of its own, #7741; M10/G5: Neon & Glow built-in graphic style library (Cyan Neon, Magenta Laser, Amber Tube, Electric Lime, Pulse Violet, Cobalt Phosphor); previously: Tech Circuit brush library, G5; previously: Graphic Styles list fills a taller panel, #2992; scores and estimates unchanged; previously: PDF import: glyphs in a span with an empty ActualText come in as outlines, #6971; scores and estimates unchanged; previously: library panels' lists fill a taller panel, #2992; scores and estimates unchanged; previously: Swatches list fills a taller panel, #1638; scores and estimates unchanged; previously: icon-strip flyouts also resize from the top edge and the canvas-side top corner, keeping the moved top in workspaces (storytold/craft-libs#1094); scores and estimates unchanged; previously: #6865: explicitly requested oversized editing artboard; Live Paint Bucket fills faces crossed in one drag (#6373); previously: #6404: transform-aware Eyedropper character copying; scores and estimates unchanged; previously: M10/G5: Energy Beams brush library; MCP docs list Energy Beams; previously minor: M10/G5: Skill Icons symbol library; MCP docs list Skill Icons; previously minor: M10/G5: Status Effects graphic style library; MCP docs catch-up for symbol libraries; previously minor: M10/G5: Inventory Icons built-in symbol library; previously minor: Edit › Edit Custom Dictionary…: its dialog adds, deletes and changes the custom dictionary's words, #4936; previously minor: M10/G5: Game HUD graphic style library; previously minor: resizable icon-strip flyouts and bottom-aligned panel footers, #5713; previously minor: M10/G5: Map Markers built-in symbol library; previously minor: right-click on type: Spelling › Auto Spell Check, with its check mark, #4936; previously minor: right-click on a word Auto Spell Check underlined: its suggestions, Ignore All and Add to Dictionary, #4936; previously minor: G2: Effect Gallery thumbnails and in-dialog preview are in; Auto Spell Check: `edit.autoSpellCheck` underlines the unknown words, #4936; previously minor: PDF editable import preserves authored ActualText once, including empty/nested spans and authored ordering (#6165); cross-line/style layout remains approximate; scores and estimates unchanged; PDF marked-text export (#6309): compatible glyphs stay on one layout line with per-glyph offsets; scores and estimates unchanged; interim macOS cursor delivery, #2292; native validation pending; scores and estimates unchanged; Control bar › Snapping includes the existing Snap to Glyph and Alignment Guides toggles (#6164); scores and estimates unchanged; custom dictionary and Ignore All: `text.spelling.addWord`, `removeWord`, `changeWord`, `dictionary` and `ignoreAll`, #4936; previously minor: EPS import: embedded fonts (composite, Type 42, CID-keyed, Type 1, CFF FontSet) draw their glyphs; spell check engine: `text.spelling.check` and `text.spelling.suggest` on craft-proof, #4936; previously minor: floating tab groups collapse into the side icon rail and opened rail panels fold back into it, #5925 in part; M4/M7: `.ai`/EPS type keeps its tab stops, and right-aligned lines with tabs lay out as the file's page, #6147; M4/M7: `.ai`/EPS type from the text document lays its lines out closer to the file's page, within limits, #6137; numeric fields step on wheel hover without taking keyboard focus, #5949; Character Styles panel: a double-click on a style's row opens its Character Style Options; the dialog keeps a fixed width and scrolls its sections, so its buttons stay on screen; Selection QoL: marquee modes and visible feedback, #5313; SVG CSS classes survive export and repeated import in all four styling modes (#2480); current-main integration retains event attributes and scripts; #3380 deletion-only review follow-up: independent survivors keep gradient placement, owned subpaths avoid discarded copies, and contracts/status/evidence are clarified; endpoint highlighting remains open; scores and estimates unchanged; Indian-language hyphenation review and license allowlist, #4947; Hindi catalog and contributor loanword preferences; full wording review in progress; Effect dialogs: a colour swatch beside a hex colour opens the Color Picker, #5365; shape tools move the selection from its centre point and turn it from the zone outside a box corner, #5477; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x) > > Oversized artboard import update (2026-11-12): Explicit editing-data import retains a single artboard beyond a capped 14,400 pt PDF page (#6865). > @@ -244,6 +244,7 @@ not take the artwork yet. Overflow-menu drag remains separate. Scores and hours | 2026-11-16 | minor | Eraser review (#6582): hidden Rasterize rows and hidden strokes with gradients along or across their paths do not block preserving visible fitted gradients. Visible unsupported paint branches retain existing fitting. Scores and estimates unchanged. | | 2026-11-16 | minor | Eraser review (#6582): ordinary Group/Layer own paints and reproducible evaluated gradient placements are preserved as members are cut. Replacement-art effects, plug-ins/Rasterize, along/across-stroke gradients and placements that cannot reproduce the original appearance keep existing fitting. Scores and estimates unchanged. | | 2026-11-16 | minor | Color panel: the spectrum fills the vertical space of a resized panel, with options shown or hidden (#8005). Compact auto-fit flyouts and embedded mixers keep their existing size. Evidence: panels::color::tests::the_spectrum_grows_with_the_color_panel. Scores and estimates unchanged. | +| 2026-11-15 | minor | M14: localized Windows/Linux menu access keys and nested navigation, including Select Save/Edit (#6596); estimates unchanged. | | 2026-11-15 | minor | PDF import: stroked type (text rendering modes 1, 2, 5 and 6, and glyphs under `ActualText`) keeps the line cap, line join and miter limit of the graphics state it is stroked with, as paths do, instead of butt caps, miter joins and a miter limit of 10; a glyph filled and then stroked otherwise than the run its fill joined comes in as a run of its own, so the glyphs before it keep their stroke (#7741; `imported_stroked_type_keeps_the_files_cap_join_and_miter_limit` in `crates/pdf/src/tests/textstroke.rs`). Scores and estimates unchanged. | | 2026-11-15 | minor | M10/G5: Neon & Glow built-in graphic style library (Cyan Neon, Magenta Laser, Amber Tube, Electric Lime, Pulse Violet, Cobalt Phosphor); estimates unchanged | | 2026-11-14 | minor | #7717: Backquote/~ arrow nudges for selected pattern fills and strokes retain normal increment/Shift and idle-tool behavior. Scores and estimates unchanged. | diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 276db3337b..1a3143316e 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -1,6 +1,6 @@ # Parity with Adobe Illustrator -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-18 · **Change:** minor (Backquote/~ arrow pattern nudges (#7717); scores and estimates unchanged; previously: Window > Toolbars > Compact Tools offers optional denser main Tools spacing (#7234); default layout, scores and estimates unchanged; previously: Direct Selection: Space during an ordinary path's handle drag repositions its anchor and handles, including a Pen loan (#7237, request 3 only; scores and estimates unchanged); previously: SVG export preserves document units on root width/height for physical units, #864; G11 estimate 8–15 → 6–13 h; previously: Floating panels keep their window level while focus moves between the app's windows, so a press on one panel's bar no longer hands the keyboard to another, #6986; scores and estimates unchanged; previously minor: #8128: `.ai` and EPS import: clipping paths grouped in a compound path are its subpaths, so the compound clipping path clips its clipping group; scores and estimates unchanged; previously: import: type filled and stroked by a `TJ` whose kerning starts a new line comes in filled and stroked, #8543; PDF Retype phase 1 (#4934): Type › Retype (`type.retype`) turns outlined text that exactly matches an available font back into point text; scores and estimates unchanged; previously: Lock Guides: a selection marquee (Selection, Direct Selection, Group Selection, Enclosing Lasso) leaves out paths made into guides inside groups and compound paths too, as clicks do (#3074), so a group is no longer selected by a locked guide in it; an enclosing marquee measures a group without its locked or hidden guides, and Direct Selection takes no anchor or segment of a guide that can't be picked; a guide in a group still moves with its group (#8538); Production Preflight: output-aware fonts, text overflow, linked files and effective image resolution, clickable findings and automatic rechecking; scores and estimates unchanged; previously: PDF export writes the document language as the catalog's `/Lang`, #3644; Layers panel: an Alt-drag copies a row above or below itself, so the top layer dragged up, the bottom layer dragged down and a lone layer are copied, #8237; scores and estimates unchanged; previously: Twist: a strongly twisted path joins its pieces without kinks, #7069; scores and estimates unchanged; previously: PDF import: a glyph filled only after a glyph filled and stroked comes in filled only, not stroked, #8300; PDF import: translucent type filled and stroked comes in as a filled type object and a stroked one, as the file composites them, and an upright glyph is never kept as the outline of its glyph alone, #8015; PDF import: type filled and stroked by one text-showing operator comes in as one type object, filled and stroked, not a stroked copy over a filled one, #8015; Layers panel: Alt over the list shows the copy cursor while rows or the selection square are dragged, #8217; scores and estimates unchanged; previously: Gradient panel: the add-stop strip under the ramp shows the white arrow with a plus on Windows and X11, #8241; scores and estimates unchanged; previously: Properties panel: the Character section shows the font of the Type tool's selection, not the first run's (#8189); scores and estimates unchanged; previously: Recolor Artwork follow-up (#8031, remaining #4028): native Lab input, picker swatch libraries and Assign-row menus; UI interaction regression coverage; scores and estimates unchanged; previously: Eraser review: hidden Rasterize and Along/Across stroke rows do not block preserving visible gradients; scores and estimates unchanged; previously: Eraser review: ordinary Group/Layer paints and reproducible evaluated gradient placements are preserved; other placements retain existing fitting; scores and estimates unchanged; previously: Eraser: shared fill-only area cutting for fixed and varied tips and the Alt-drag marquee, #6582; scores and estimates unchanged; previously: #8005: the Color spectrum fills a resized panel; scores and estimates unchanged; previously: Paragraph composers (#4935): the Paragraph panel menu and paragraph styles offer four composers, the Middle Eastern & South Asian Single-line and Every-line (how all type is set, and the default) and a Standard Single-line and Every-line that set Indic, Arabic and Hebrew type glyph by glyph as the font maps it, for legacy fonts that keep a script on Latin character codes; PDF import: stroked type keeps the line cap, line join and miter limit the file strokes it with, a glyph stroked otherwise than the run it joins coming in as a run of its own, #7741; G5: Neon & Glow joins built-in graphic style libraries (Cyan Neon, Magenta Laser, Amber Tube, Electric Lime, Pulse Violet, Cobalt Phosphor); scores and estimates unchanged; previously: Pencil ignores Smart Guides and Snap to Point and shows no Smart Guides, #7252; previously: Pencil continuation, straight-line and closing cursors; scores and estimates unchanged; previously: G5: Weather Icons joins built-in symbol libraries (Sun, Moon, Cloud, Rain, Thunder, Snow); scores and estimates unchanged; previously: a closed Pencil stroke closes with a straight segment; previously: Snap to Point with Smart Guides off draws no Smart Guides labels or lines, #7250; previously: 3D: the seams of Extrude & Bevel, Inflate and Rotate under a white light, and of the faces of Extrude & Bevel (Classic), Revolve (Classic) and Rotate (Classic), went from miter to round joins, so white-light 3D output is expected to differ from the 2026-10-17 comparison at facet corners (not measured: the scenes were not exported again); previously: `.ai` and EPS import: in layers that don't draw as the page, art that differs away from an envelope of type no longer costs it its editable type; it keeps its drawn art where, in the pixels it and its drawn art ink, the layers with it differ from the page more than its own check allows, or past the envelopes' share of the page check, #7141; Character panel: the Set Font Height Reference dropdown shows an icon before each reference, #6304; scores and estimates unchanged; previously: Envelopes: a top object's side whose pieces are all one curve split at anchors follows that curve's parameter, so a top object saved with its sides' curves in pieces draws as its `.ai` drawn art, #7097; scores and estimates unchanged; previously: Graphic Styles list fills a taller panel, #2992; scores and estimates unchanged; previously: PDF import: glyphs in a span with an empty ActualText come in as outlines, #6971; scores and estimates unchanged; previously: library panels' lists fill a taller panel, #2992; scores and estimates unchanged; previously: Swatches list fills a taller panel, #1638; scores and estimates unchanged; previously minor: Object › Rasterize with the Grayscale or Bitmap colour model makes a grayscale image, #6969; scores and estimates unchanged; previously minor: `.ai` and EPS import: type in an envelope with Distort Appearance is also tried mapped from the box of what it paints, miter tips and moved strokes included, after its glyphs grown by half its strokes' weight (#6824; #6617: Swatches panel menu: Show Recent Colors; scores unchanged; previously minor: icon-strip flyouts also resize from the top edge and the canvas-side top corner, keeping the moved top in workspaces (storytold/craft-libs#1094); scores and estimates unchanged; previously: #6865: explicitly requested oversized editing artboard; macOS: the canvas cursor stays after the pointer moves, #6362; scores and estimates unchanged; previously minor: Type tool: kerning at a caret at the start of a line moves the character after it, #5111; scores and estimates unchanged; previously minor: Rulers: the zero point dragged out of the rulers' corner snaps as a drawn point does; previously minor: Live Paint Bucket fills faces crossed in one drag (#6373); previously: #6404: transform-aware Eyedropper character copying; scores and estimates unchanged; previously: Envelopes: with Distort Appearance, type's strokes paint along the bent glyph outlines at their own weight, as users' `.ai` files draw them, which changes how VectorCraft's own envelopes of stroked type draw (#6644; scores and estimates unchanged); previously minor: G5: Energy Beams brush library; bundled content ~44% → ~46%; previously minor: G5: Skill Icons symbol library; bundled content ~42% → ~44%; previously minor: `.ai` and EPS import: an envelope saved in Edit Contents whose mesh lies away from its drawn art by a move opens live on that art (#6570; scores and estimates unchanged); previously minor: ruler double-click adds a guide at the pointer, #5239; G5: Status Effects graphic style library; bundled content ~40% → ~42%; MCP symbol libraries list UI Frames and Map Markers; previously minor: G5: Inventory Icons built-in symbol library; bundled content ~38% → ~40%; previously minor: `.ai` and EPS import: stroked type in an envelope maps from its glyphs grown by half its stroke (#3179; scores and estimates unchanged); previously minor: `.ai` and EPS import: warps of type open as mesh envelopes on their saved grid where VectorCraft's warp doesn't draw as their drawn art (#3179; scores and estimates unchanged); G5: Game Trails brush library; bundled content ~36% → ~38%; previously minor: Edit › Edit Custom Dictionary…: its dialog adds, deletes and changes the custom dictionary's words, #4936; previously minor: `.ai` and EPS import: envelopes of type open live where they draw as their drawn art and the layers with them draw as the page (#3179; scores and estimates unchanged); G5: Game HUD graphic style library; bundled content ~34% → ~36%; previously minor: Line Arrow arrowhead (#5421; scores and estimates unchanged); G5: Map Markers built-in symbol library; bundled content ~32% → ~34%; previously minor: right-click on type: Spelling › Auto Spell Check, with its check mark, #4936; previously minor: right-click on a word Auto Spell Check underlined: its suggestions, Ignore All and Add to Dictionary, #4936; previously minor: Canvas: a 3D effect changed on type or a group redraws where its solid was; Fit to Artwork Bounds and per-artboard SVG export build each solid once for all artboards; previously minor: Effect Gallery: a thumbnail for each filter and a preview area inside the dialog, on an original drawing; Raster effects 52% → 55%, hours 1–2 → none; headline numbers unchanged; Auto Spell Check: `edit.autoSpellCheck` underlines the unknown words, #4936; previously minor: PDF editable import preserves authored ActualText once, including empty/nested spans and authored ordering (#6165); cross-line/style layout remains approximate; scores and estimates unchanged; PDF marked-text export (#6309): compatible glyphs stay on one layout line with per-glyph offsets; scores and estimates unchanged; G5: UI Frames built-in symbol library with default 9-slice; bundled content ~32%; previously minor: G5: dynamic symbol part on-canvas opacity/blend/gradient/pattern; strokes remaining no longer lists Overlap/auto corners; symbols ~88%; previously minor: interim macOS cursor delivery, #2292; native validation pending; scores and estimates unchanged; previously minor: harakat paint fallback clarified; previously minor: current Guides feature-area rows consolidated using existing ruler evidence; scores and estimates unchanged; previously minor: Control bar › Snapping includes the existing Snap to Glyph and Alignment Guides toggles (#6164); scores and estimates unchanged; previously minor: G5 docs: Art brush Overlap and Pattern brush auto corners removed from strokes remaining; symbols remaining lists dynamic on-canvas beyond solid and guides outside the art; previously minor: custom dictionary and Ignore All: `text.spelling.addWord`, `removeWord`, `changeWord`, `dictionary` and `ignoreAll`, #4936; previously minor: EPS import: embedded fonts (composite, Type 42, CID-keyed, Type 1, CFF FontSet) draw their glyphs; spell check engine: `text.spelling.check` and `text.spelling.suggest` on craft-proof, #4936; previously minor: floating tab groups collapse into the side icon rail and opened rail panels fold back into it, #5925 in part; `.ai`/EPS type keeps its tab stops, and right-aligned lines with tabs lay out as the file's page, #6147; `.ai`/EPS type from the text document lays its lines out closer to the file's page, within limits, #6137; `.ai` and EPS import: older Art brush objects read; numeric fields step on wheel hover without taking keyboard focus, and a panel wheel turn cannot seed a canvas zoom glide, #5949; Character Styles panel: a double-click on a style's row opens its Character Style Options; the dialog keeps a fixed width and scrolls its sections, so its buttons stay on screen; Tools stays beside the canvas with left-side panels; new gradients follow document color mode; Selection QoL: marquee modes and visible feedback, #5313; SVG CSS classes survive export and repeated import in all four styling modes (#2480); current-main integration retains event attributes and scripts; #3380 deletion-only review follow-up: independent survivors keep gradient placement, owned subpaths avoid discarded copies, and contracts/status/evidence are clarified; endpoint highlighting remains open; scores and estimates unchanged; the canvas keeps selection outlines and anchors between frames; Indian-language hyphenation review and license allowlist, #4947; Stroke gradients: an arrowhead aligned to the tip is painted to the corners of its base, #5964; Drop Shadow and glow dialogs: spinner arrows, #5367, #5368; Stroke Weight Up and Down shortcuts, #5797; Hindi catalog and contributor loanword preferences; full wording review in progress; Properties in Edit Artboards: a Transform section with the reference point above the Artboards section, #5219; the Control bar's Stroke: and Opacity: links scrub their fields, #4088; an image zoomed in on is separated, colorized or proofed only where it shows (#4155); a document's first frame renders on the render worker, so opening a heavy file no longer freezes the window, #4155; Control bar Paragraph section with type selected, #5372; translating unchanged type reuses its glyph and character-stroke outlines; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x; public release notes through 30.7, August 2026; Units › East Asian Type acts, with Q and Ha units; scores unchanged) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-18 · **Change:** minor (Windows/Linux menu access keys and localized cues (#6596); previously: Backquote/~ arrow pattern nudges (#7717); scores and estimates unchanged; previously: Window > Toolbars > Compact Tools offers optional denser main Tools spacing (#7234); default layout, scores and estimates unchanged; previously: Direct Selection: Space during an ordinary path's handle drag repositions its anchor and handles, including a Pen loan (#7237, request 3 only; scores and estimates unchanged); previously: SVG export preserves document units on root width/height for physical units, #864; G11 estimate 8–15 → 6–13 h; previously: Floating panels keep their window level while focus moves between the app's windows, so a press on one panel's bar no longer hands the keyboard to another, #6986; scores and estimates unchanged; previously minor: #8128: `.ai` and EPS import: clipping paths grouped in a compound path are its subpaths, so the compound clipping path clips its clipping group; scores and estimates unchanged; previously: import: type filled and stroked by a `TJ` whose kerning starts a new line comes in filled and stroked, #8543; PDF Retype phase 1 (#4934): Type › Retype (`type.retype`) turns outlined text that exactly matches an available font back into point text; scores and estimates unchanged; previously: Lock Guides: a selection marquee (Selection, Direct Selection, Group Selection, Enclosing Lasso) leaves out paths made into guides inside groups and compound paths too, as clicks do (#3074), so a group is no longer selected by a locked guide in it; an enclosing marquee measures a group without its locked or hidden guides, and Direct Selection takes no anchor or segment of a guide that can't be picked; a guide in a group still moves with its group (#8538); Production Preflight: output-aware fonts, text overflow, linked files and effective image resolution, clickable findings and automatic rechecking; scores and estimates unchanged; previously: PDF export writes the document language as the catalog's `/Lang`, #3644; Layers panel: an Alt-drag copies a row above or below itself, so the top layer dragged up, the bottom layer dragged down and a lone layer are copied, #8237; scores and estimates unchanged; previously: Twist: a strongly twisted path joins its pieces without kinks, #7069; scores and estimates unchanged; previously: PDF import: a glyph filled only after a glyph filled and stroked comes in filled only, not stroked, #8300; PDF import: translucent type filled and stroked comes in as a filled type object and a stroked one, as the file composites them, and an upright glyph is never kept as the outline of its glyph alone, #8015; PDF import: type filled and stroked by one text-showing operator comes in as one type object, filled and stroked, not a stroked copy over a filled one, #8015; Layers panel: Alt over the list shows the copy cursor while rows or the selection square are dragged, #8217; scores and estimates unchanged; previously: Gradient panel: the add-stop strip under the ramp shows the white arrow with a plus on Windows and X11, #8241; scores and estimates unchanged; previously: Properties panel: the Character section shows the font of the Type tool's selection, not the first run's (#8189); scores and estimates unchanged; previously: Recolor Artwork follow-up (#8031, remaining #4028): native Lab input, picker swatch libraries and Assign-row menus; UI interaction regression coverage; scores and estimates unchanged; previously: Eraser review: hidden Rasterize and Along/Across stroke rows do not block preserving visible gradients; scores and estimates unchanged; previously: Eraser review: ordinary Group/Layer paints and reproducible evaluated gradient placements are preserved; other placements retain existing fitting; scores and estimates unchanged; previously: Eraser: shared fill-only area cutting for fixed and varied tips and the Alt-drag marquee, #6582; scores and estimates unchanged; previously: #8005: the Color spectrum fills a resized panel; scores and estimates unchanged; previously: Paragraph composers (#4935): the Paragraph panel menu and paragraph styles offer four composers, the Middle Eastern & South Asian Single-line and Every-line (how all type is set, and the default) and a Standard Single-line and Every-line that set Indic, Arabic and Hebrew type glyph by glyph as the font maps it, for legacy fonts that keep a script on Latin character codes; PDF import: stroked type keeps the line cap, line join and miter limit the file strokes it with, a glyph stroked otherwise than the run it joins coming in as a run of its own, #7741; G5: Neon & Glow joins built-in graphic style libraries (Cyan Neon, Magenta Laser, Amber Tube, Electric Lime, Pulse Violet, Cobalt Phosphor); scores and estimates unchanged; previously: Pencil ignores Smart Guides and Snap to Point and shows no Smart Guides, #7252; previously: Pencil continuation, straight-line and closing cursors; scores and estimates unchanged; previously: G5: Weather Icons joins built-in symbol libraries (Sun, Moon, Cloud, Rain, Thunder, Snow); scores and estimates unchanged; previously: a closed Pencil stroke closes with a straight segment; previously: Snap to Point with Smart Guides off draws no Smart Guides labels or lines, #7250; previously: 3D: the seams of Extrude & Bevel, Inflate and Rotate under a white light, and of the faces of Extrude & Bevel (Classic), Revolve (Classic) and Rotate (Classic), went from miter to round joins, so white-light 3D output is expected to differ from the 2026-10-17 comparison at facet corners (not measured: the scenes were not exported again); previously: `.ai` and EPS import: in layers that don't draw as the page, art that differs away from an envelope of type no longer costs it its editable type; it keeps its drawn art where, in the pixels it and its drawn art ink, the layers with it differ from the page more than its own check allows, or past the envelopes' share of the page check, #7141; Character panel: the Set Font Height Reference dropdown shows an icon before each reference, #6304; scores and estimates unchanged; previously: Envelopes: a top object's side whose pieces are all one curve split at anchors follows that curve's parameter, so a top object saved with its sides' curves in pieces draws as its `.ai` drawn art, #7097; scores and estimates unchanged; previously: Graphic Styles list fills a taller panel, #2992; scores and estimates unchanged; previously: PDF import: glyphs in a span with an empty ActualText come in as outlines, #6971; scores and estimates unchanged; previously: library panels' lists fill a taller panel, #2992; scores and estimates unchanged; previously: Swatches list fills a taller panel, #1638; scores and estimates unchanged; previously minor: Object › Rasterize with the Grayscale or Bitmap colour model makes a grayscale image, #6969; scores and estimates unchanged; previously minor: `.ai` and EPS import: type in an envelope with Distort Appearance is also tried mapped from the box of what it paints, miter tips and moved strokes included, after its glyphs grown by half its strokes' weight (#6824; #6617: Swatches panel menu: Show Recent Colors; scores unchanged; previously minor: icon-strip flyouts also resize from the top edge and the canvas-side top corner, keeping the moved top in workspaces (storytold/craft-libs#1094); scores and estimates unchanged; previously: #6865: explicitly requested oversized editing artboard; macOS: the canvas cursor stays after the pointer moves, #6362; scores and estimates unchanged; previously minor: Type tool: kerning at a caret at the start of a line moves the character after it, #5111; scores and estimates unchanged; previously minor: Rulers: the zero point dragged out of the rulers' corner snaps as a drawn point does; previously minor: Live Paint Bucket fills faces crossed in one drag (#6373); previously: #6404: transform-aware Eyedropper character copying; scores and estimates unchanged; previously: Envelopes: with Distort Appearance, type's strokes paint along the bent glyph outlines at their own weight, as users' `.ai` files draw them, which changes how VectorCraft's own envelopes of stroked type draw (#6644; scores and estimates unchanged); previously minor: G5: Energy Beams brush library; bundled content ~44% → ~46%; previously minor: G5: Skill Icons symbol library; bundled content ~42% → ~44%; previously minor: `.ai` and EPS import: an envelope saved in Edit Contents whose mesh lies away from its drawn art by a move opens live on that art (#6570; scores and estimates unchanged); previously minor: ruler double-click adds a guide at the pointer, #5239; G5: Status Effects graphic style library; bundled content ~40% → ~42%; MCP symbol libraries list UI Frames and Map Markers; previously minor: G5: Inventory Icons built-in symbol library; bundled content ~38% → ~40%; previously minor: `.ai` and EPS import: stroked type in an envelope maps from its glyphs grown by half its stroke (#3179; scores and estimates unchanged); previously minor: `.ai` and EPS import: warps of type open as mesh envelopes on their saved grid where VectorCraft's warp doesn't draw as their drawn art (#3179; scores and estimates unchanged); G5: Game Trails brush library; bundled content ~36% → ~38%; previously minor: Edit › Edit Custom Dictionary…: its dialog adds, deletes and changes the custom dictionary's words, #4936; previously minor: `.ai` and EPS import: envelopes of type open live where they draw as their drawn art and the layers with them draw as the page (#3179; scores and estimates unchanged); G5: Game HUD graphic style library; bundled content ~34% → ~36%; previously minor: Line Arrow arrowhead (#5421; scores and estimates unchanged); G5: Map Markers built-in symbol library; bundled content ~32% → ~34%; previously minor: right-click on type: Spelling › Auto Spell Check, with its check mark, #4936; previously minor: right-click on a word Auto Spell Check underlined: its suggestions, Ignore All and Add to Dictionary, #4936; previously minor: Canvas: a 3D effect changed on type or a group redraws where its solid was; Fit to Artwork Bounds and per-artboard SVG export build each solid once for all artboards; previously minor: Effect Gallery: a thumbnail for each filter and a preview area inside the dialog, on an original drawing; Raster effects 52% → 55%, hours 1–2 → none; headline numbers unchanged; Auto Spell Check: `edit.autoSpellCheck` underlines the unknown words, #4936; previously minor: PDF editable import preserves authored ActualText once, including empty/nested spans and authored ordering (#6165); cross-line/style layout remains approximate; scores and estimates unchanged; PDF marked-text export (#6309): compatible glyphs stay on one layout line with per-glyph offsets; scores and estimates unchanged; G5: UI Frames built-in symbol library with default 9-slice; bundled content ~32%; previously minor: G5: dynamic symbol part on-canvas opacity/blend/gradient/pattern; strokes remaining no longer lists Overlap/auto corners; symbols ~88%; previously minor: interim macOS cursor delivery, #2292; native validation pending; scores and estimates unchanged; previously minor: harakat paint fallback clarified; previously minor: current Guides feature-area rows consolidated using existing ruler evidence; scores and estimates unchanged; previously minor: Control bar › Snapping includes the existing Snap to Glyph and Alignment Guides toggles (#6164); scores and estimates unchanged; previously minor: G5 docs: Art brush Overlap and Pattern brush auto corners removed from strokes remaining; symbols remaining lists dynamic on-canvas beyond solid and guides outside the art; previously minor: custom dictionary and Ignore All: `text.spelling.addWord`, `removeWord`, `changeWord`, `dictionary` and `ignoreAll`, #4936; previously minor: EPS import: embedded fonts (composite, Type 42, CID-keyed, Type 1, CFF FontSet) draw their glyphs; spell check engine: `text.spelling.check` and `text.spelling.suggest` on craft-proof, #4936; previously minor: floating tab groups collapse into the side icon rail and opened rail panels fold back into it, #5925 in part; `.ai`/EPS type keeps its tab stops, and right-aligned lines with tabs lay out as the file's page, #6147; `.ai`/EPS type from the text document lays its lines out closer to the file's page, within limits, #6137; `.ai` and EPS import: older Art brush objects read; numeric fields step on wheel hover without taking keyboard focus, and a panel wheel turn cannot seed a canvas zoom glide, #5949; Character Styles panel: a double-click on a style's row opens its Character Style Options; the dialog keeps a fixed width and scrolls its sections, so its buttons stay on screen; Tools stays beside the canvas with left-side panels; new gradients follow document color mode; Selection QoL: marquee modes and visible feedback, #5313; SVG CSS classes survive export and repeated import in all four styling modes (#2480); current-main integration retains event attributes and scripts; #3380 deletion-only review follow-up: independent survivors keep gradient placement, owned subpaths avoid discarded copies, and contracts/status/evidence are clarified; endpoint highlighting remains open; scores and estimates unchanged; the canvas keeps selection outlines and anchors between frames; Indian-language hyphenation review and license allowlist, #4947; Stroke gradients: an arrowhead aligned to the tip is painted to the corners of its base, #5964; Drop Shadow and glow dialogs: spinner arrows, #5367, #5368; Stroke Weight Up and Down shortcuts, #5797; Hindi catalog and contributor loanword preferences; full wording review in progress; Properties in Edit Artboards: a Transform section with the reference point above the Artboards section, #5219; the Control bar's Stroke: and Opacity: links scrub their fields, #4088; an image zoomed in on is separated, colorized or proofed only where it shows (#4155); a document's first frame renders on the render worker, so opening a heavy file no longer freezes the window, #4155; Control bar Paragraph section with type selected, #5372; translating unchanged type reuses its glyph and character-stroke outlines; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x; public release notes through 30.7, August 2026; Units › East Asian Type acts, with Q and Ha units; scores unchanged) > > Tech Circuit update (2026-11-14): three original procedural brushes; ten built-in brush libraries (G5). > @@ -1154,6 +1154,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur - A Recent Commands button beside the Help › Search Commands field lists the last five commands, tools, panels and effects picked from the palette, most recent first, with a command picked again moved to the top. Choosing a row closes the palette and runs it as a pick of the same result does; with no picks yet the list shows a dimmed No recent commands row, and a command that is not available now, such as a filter of a plug-in that is not loaded, is left out until it comes back. The ids are saved with the UI state. While the list is open, Up and Down move through its rows, wrapping at the ends, and Escape closes the list before the palette. This is VectorCraft's own addition and does not raise a score (#6376; `palette` tests `recent_commands_*`, `a_recent_command_runs_what_its_pick_runs`, `the_keys_wrap_within_recent_commands`, `escape_closes_recent_commands_before_the_palette`). - The app bar's search control is a field showing a magnifier, "Search commands" and the Help › Search Commands… shortcut. The field shows no shortcut when the shortcut is cleared or too long to fit beside the text; the tooltip and the screen-reader name still give it. A click on the field, or Enter or Space while it has the keyboard focus, toggles the command palette as the shortcut does, and the palette's popup holds the text field. While the field has the focus, the app's existing rule for a focused control keeps the app's own keys off, so Enter does not open Move and Tab moves the focus on. While a dialog is open the field and the icon are drawn disabled and do nothing, as the shortcut does. Screen readers name the field and the icon Search commands, with the shortcut. As the bar narrows, the community button goes first, then Explore tutorials, then the field becomes the magnifier icon, then the workspace switcher narrows to 64 points, then the icon goes; Safe Mode's label keeps its room first. The field is wider than the icon, so the community button and Explore tutorials go at wider bars than they did beside the icon. This is VectorCraft's own addition and does not raise a score (`chrome::tests`: `the_app_bar_gives_up_its_right_hand_controls_in_order`, `a_wide_app_bar_shows_a_search_field_with_the_palette_shortcut`, `the_search_field_follows_the_palettes_shortcut`, `a_long_shortcut_leaves_the_search_hint_readable`, `a_click_on_the_search_field_opens_the_palette`, `the_search_icon_has_the_fields_name_and_both_are_disabled_under_a_dialog`, `the_keyboard_opens_the_palette_from_the_search_field`, `a_narrowing_app_bar_turns_the_search_field_into_the_icon`). - The Learn panel (Window › Learn, or Explore tutorials beside the search field on the app bar) has a For you tab with a Get started section and a Quick skill guide card, and a Skills tab that lists VectorCraft's own skills with their progress rings and counts of tutorials finished; a skill lists its tutorials, a tutorial shows its numbered steps, and Back goes up a level; `learn.list`, `learn.tab {tab}`, `learn.skill {skill}`, `learn.show {tutorial}` and `learn.back` script it, and the tab buttons, the rows and Back run them ([the help page](https://helpx.adobe.com/illustrator/desktop/get-started/learn-the-basics/learn-skills-quick-skill-guide.html); `panels::learn::tests`). + - **Windows/Linux menu access keys (#6596):** Alt+letter opens any of the nine in-window menu roots, with access letters underlined in the current language; letters and arrow keys reach visible nested and dynamic menus. Alt+O, P, Right, O opens Offset Path; in English, Alt+S, S opens Save Selection and Alt+S, E opens Edit Selection. Disabled items stay unavailable, colliding letters cycle choices for Enter, and changed menus discard stale choices. Escape and focus loss dismiss menu access while text editing, IME/AltGr input, custom shortcuts and active tool/pointer gestures keep their normal ownership. Keyboard focus reveals rows in long menus and wheel scrolling returns control to the pointer (`crates/ui-egui/tests/menu_access_keys.rs`). - A tool's name in a Learn tutorial step is a blue link that shows where the tool is without choosing it (`learn.locateTool {tool}`): its toolbar button is marked, a collapsed group's flyout opens with the tool's row marked, a torn-off strip comes to the front, and a tool no shown toolbar holds is marked in the All Tools drawer. The mark, its 3 seconds and the hidden-toolbar cases are VectorCraft's own rules ([the help page](https://helpx.adobe.com/illustrator/desktop/get-started/learn-the-basics/learn-skills-quick-skill-guide.html); `panels::learn::tests`, the `a_learn_link_*` tests in `toolbar::tests`). - Under a tutorial's steps, View more opens the tutorial's own practice sample as a new untitled document, and once the tutorial is finished, Next Up moves to the next tutorial in the same skill, as the help page describes ([the help page](https://helpx.adobe.com/illustrator/desktop/get-started/learn-the-basics/learn-skills-quick-skill-guide.html)). The samples are VectorCraft's own drawings. A Finish tutorial button that shows once the sample is open, the untitled copy, Back to skills in place of Next Up after a skill's last tutorial, and Next Up showing the next tutorial without opening its sample are VectorCraft's own rules. `learn.openSample`, `learn.finish`, `learn.next` and `learn.skills` (Back to skills) script them. Not done: the help page's short video. Regression tests: `view_more_opens_the_tutorial_s_sample_as_a_new_untitled_document`, `finishing_a_tutorial_offers_next_up_in_its_skill`, `the_practice_controls_work_from_the_keyboard`, `the_last_tutorial_of_a_skill_offers_back_to_skills`, `learn_finish_and_learn_next_follow_the_practice`, `learn_skills_shows_the_list_of_skills`, `the_practice_commands_reject_a_missing_or_unknown_tutorial`, `every_tutorial_has_its_own_readable_sample` and `the_next_tutorial_is_the_next_one_in_the_same_skill` in `crates/ui-egui/src/panels/learn/tests.rs`. - A Learn tutorial's steps are marked complete as the learner works, and a skill's progress ring fills as its tutorials are finished, as the help page describes ([the help page](https://helpx.adobe.com/illustrator/desktop/get-started/learn-the-basics/learn-skills-quick-skill-guide.html)). Each step has a check box that marks it done once the tutorial's sample is open (`learn.markStep`); Finish tutorial marks every step done; a skill's count shows its tutorials finished of all, and a finished tutorial has a check mark in its skill's list. Marking steps by hand, the count, keeping the progress in the preferences (the web build keeps it while the page is open) and Reset progress (`learn.resetProgress`) are VectorCraft's own rules; `learn.list` reports the progress. Regression tests: `a_step_s_check_box_marks_only_that_step`, `a_step_s_check_box_works_from_the_keyboard`, `finishing_tutorials_fills_their_skill_s_ring_and_count`, `a_skill_with_no_tutorials_shows_0_of_0`, `learn_mark_step_checks_its_params`, `reset_progress_clears_only_the_progress`, `the_preferences_keep_the_progress` and `saved_progress_is_read_leniently` in `crates/ui-egui/src/panels/learn/tests.rs`. diff --git a/docs/ui-parity.md b/docs/ui-parity.md index 075902c91e..3c55ec1b25 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -1,6 +1,6 @@ # UI and interaction parity -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-18 · **Change:** minor (Backquote/~ arrow pattern nudges (#7717); scores and estimates unchanged; previously: Window > Toolbars > Compact Tools offers optional denser main Tools spacing (#7234); default layout, scores and estimates unchanged; previously: Direct Selection: Space during an ordinary path's handle drag repositions its anchor and handles, including a Pen loan (#7237, request 3 only; scores and estimates unchanged); previously: Floating panels keep their window level while focus moves between the app's windows, so a press on one panel's bar no longer hands the keyboard to another, #6986; scores and estimates unchanged; previously minor: Lock Guides: a selection marquee (Selection, Direct Selection, Group Selection, Enclosing Lasso) leaves out paths made into guides inside groups and compound paths too, as clicks do (#3074), so a group is no longer selected by a locked guide in it; an enclosing marquee measures a group without its locked or hidden guides, and Direct Selection takes no anchor or segment of a guide that can't be picked; a guide in a group still moves with its group (#8538); scores and estimates unchanged; previously: Production Preflight: output-aware fonts, text overflow, linked files and effective image resolution, clickable findings and automatic rechecking; scores and estimates unchanged; previously: Layers panel: an Alt-drag copies a row above or below itself, so the top layer dragged up, the bottom layer dragged down and a lone layer are copied, #8237; scores and estimates unchanged; previously: Layers panel: Alt over the list shows the copy cursor while rows or the selected-art square are dragged, #8217; scores and estimates unchanged; previously: Gradient panel: the add-stop strip under the ramp shows the white arrow with a plus on Windows and X11, #8241; scores and estimates unchanged; previously: Recolor Artwork follow-up (#8031, remaining #4028): native Lab input, picker swatch libraries and Assign-row menus; UI interaction regression coverage; scores and estimates unchanged; previously: Eraser review: hidden Rasterize and Along/Across stroke rows do not block preserving visible gradients; scores and estimates unchanged; previously: Eraser review: ordinary Group/Layer paints and reproducible evaluated gradient placements are preserved; other placements retain existing fitting; scores and estimates unchanged; previously: Eraser: shared fill-only area cutting for fixed and varied tips and the Alt-drag marquee, #6582; scores and estimates unchanged; previously: #8005: the Color spectrum fills a resized panel; scores and estimates unchanged; previously: Pencil continuation, straight-line and closing cursors; scores and estimates unchanged; previously: Graphic Styles list fills a taller panel, #2992; scores and estimates unchanged; previously: library panels' lists fill a taller panel, #2992; scores and estimates unchanged; previously: Swatches list fills a taller panel, #1638; scores and estimates unchanged; previously: icon-strip flyouts also resize from the top edge and the canvas-side top corner, keeping the moved top in workspaces (storytold/craft-libs#1094); scores and estimates unchanged; previously: macOS: the canvas cursor stays after the pointer moves, #6362; scores and estimates unchanged; previously minor: Remove Background in the Contextual Task Bar, Properties › Quick Actions and the Control bar; previously minor: Ruler origin: the corner drag snaps as a drawn point does; previously minor: Live Paint Bucket fills faces crossed in one drag (#6373); previously: #6404: transform-aware Eyedropper character copying; scores and estimates unchanged; previously: Outline view: images and gradient meshes are picked on what Outline draws, so a click inside them reaches the path behind, #6437; previously minor: a middle-click on a document tab closes it, #6506; previously minor: Blob Brush: a round tip's preview is the outline of the area it adds, round at both ends, as the stroke it commits (#4343); scores and estimates unchanged; previously:; ruler double-click adds a guide at the pointer, #5239; G5: Inventory Icons built-in symbol library (four built-ins); previously minor: files that record no units open in Preferences › Units › General, #5820; previously minor: interim macOS cursor delivery, #2292; native validation pending; scores and estimates unchanged; Control bar › Snapping includes the existing Snap to Glyph and Alignment Guides toggles (#6164); scores and estimates unchanged; floating tab groups collapse into the side icon rail and opened rail panels fold back into it, #5925 in part; numeric fields step on wheel hover without taking keyboard focus, #5949; Character Styles panel: a double-click on a style's row opens its Character Style Options; the dialog keeps a fixed width and scrolls its sections, so its buttons stay on screen; Selection QoL: marquee modes and visible feedback, #5313; #3380 deletion-only review follow-up: independent survivors keep gradient placement, owned subpaths avoid discarded copies, and contracts/status/evidence are clarified; endpoint highlighting remains open; scores and estimates unchanged; Drop Shadow and glow dialogs: spinner arrows, #5367, #5368; Stroke Weight Up and Down shortcuts, #5797; Layers: Rename (`ui.rename`) opens the name field of the selected layer, group or object, #5324; Properties in Edit Artboards: Transform section above the Artboards section, #5219; scrubby labels: the Control bar's Stroke: and Opacity: links and the Properties panel's Stroke link scrub their fields, #4088; Properties: Quick Actions has Repeat Options for one selected repeat, #5181; Direct Selection: Shift-click picks several blend spine points, which drag together, #5285; Direct Selection: Cmd/Ctrl held lends the Selection tool and shows its bounding box, #3901; Join tool trims two crossing open paths and joins them at the crossing, #5844; Control bar: Paragraph: link and Align left/center/right while type is selected, #5372; shape tools: a press on the selection's centre point moves it and one in the rotate zone outside a box corner turns it, #5477; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x; Units › East Asian Type acts, with Q and Ha units; scores unchanged) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-18 · **Change:** minor (Windows/Linux menu access keys and localized cues (#6596); previously: Backquote/~ arrow pattern nudges (#7717); scores and estimates unchanged; previously: Window > Toolbars > Compact Tools offers optional denser main Tools spacing (#7234); default layout, scores and estimates unchanged; previously: Direct Selection: Space during an ordinary path's handle drag repositions its anchor and handles, including a Pen loan (#7237, request 3 only; scores and estimates unchanged); previously: Floating panels keep their window level while focus moves between the app's windows, so a press on one panel's bar no longer hands the keyboard to another, #6986; scores and estimates unchanged; previously minor: Lock Guides: a selection marquee (Selection, Direct Selection, Group Selection, Enclosing Lasso) leaves out paths made into guides inside groups and compound paths too, as clicks do (#3074), so a group is no longer selected by a locked guide in it; an enclosing marquee measures a group without its locked or hidden guides, and Direct Selection takes no anchor or segment of a guide that can't be picked; a guide in a group still moves with its group (#8538); scores and estimates unchanged; previously: Production Preflight: output-aware fonts, text overflow, linked files and effective image resolution, clickable findings and automatic rechecking; scores and estimates unchanged; previously: Layers panel: an Alt-drag copies a row above or below itself, so the top layer dragged up, the bottom layer dragged down and a lone layer are copied, #8237; scores and estimates unchanged; previously: Layers panel: Alt over the list shows the copy cursor while rows or the selected-art square are dragged, #8217; scores and estimates unchanged; previously: Gradient panel: the add-stop strip under the ramp shows the white arrow with a plus on Windows and X11, #8241; scores and estimates unchanged; previously: Recolor Artwork follow-up (#8031, remaining #4028): native Lab input, picker swatch libraries and Assign-row menus; UI interaction regression coverage; scores and estimates unchanged; previously: Eraser review: hidden Rasterize and Along/Across stroke rows do not block preserving visible gradients; scores and estimates unchanged; previously: Eraser review: ordinary Group/Layer paints and reproducible evaluated gradient placements are preserved; other placements retain existing fitting; scores and estimates unchanged; previously: Eraser: shared fill-only area cutting for fixed and varied tips and the Alt-drag marquee, #6582; scores and estimates unchanged; previously: #8005: the Color spectrum fills a resized panel; scores and estimates unchanged; previously: Pencil continuation, straight-line and closing cursors; scores and estimates unchanged; previously: Graphic Styles list fills a taller panel, #2992; scores and estimates unchanged; previously: library panels' lists fill a taller panel, #2992; scores and estimates unchanged; previously: Swatches list fills a taller panel, #1638; scores and estimates unchanged; previously: icon-strip flyouts also resize from the top edge and the canvas-side top corner, keeping the moved top in workspaces (storytold/craft-libs#1094); scores and estimates unchanged; previously: macOS: the canvas cursor stays after the pointer moves, #6362; scores and estimates unchanged; previously minor: Remove Background in the Contextual Task Bar, Properties › Quick Actions and the Control bar; previously minor: Ruler origin: the corner drag snaps as a drawn point does; previously minor: Live Paint Bucket fills faces crossed in one drag (#6373); previously: #6404: transform-aware Eyedropper character copying; scores and estimates unchanged; previously: Outline view: images and gradient meshes are picked on what Outline draws, so a click inside them reaches the path behind, #6437; previously minor: a middle-click on a document tab closes it, #6506; previously minor: Blob Brush: a round tip's preview is the outline of the area it adds, round at both ends, as the stroke it commits (#4343); scores and estimates unchanged; previously:; ruler double-click adds a guide at the pointer, #5239; G5: Inventory Icons built-in symbol library (four built-ins); previously minor: files that record no units open in Preferences › Units › General, #5820; previously minor: interim macOS cursor delivery, #2292; native validation pending; scores and estimates unchanged; Control bar › Snapping includes the existing Snap to Glyph and Alignment Guides toggles (#6164); scores and estimates unchanged; floating tab groups collapse into the side icon rail and opened rail panels fold back into it, #5925 in part; numeric fields step on wheel hover without taking keyboard focus, #5949; Character Styles panel: a double-click on a style's row opens its Character Style Options; the dialog keeps a fixed width and scrolls its sections, so its buttons stay on screen; Selection QoL: marquee modes and visible feedback, #5313; #3380 deletion-only review follow-up: independent survivors keep gradient placement, owned subpaths avoid discarded copies, and contracts/status/evidence are clarified; endpoint highlighting remains open; scores and estimates unchanged; Drop Shadow and glow dialogs: spinner arrows, #5367, #5368; Stroke Weight Up and Down shortcuts, #5797; Layers: Rename (`ui.rename`) opens the name field of the selected layer, group or object, #5324; Properties in Edit Artboards: Transform section above the Artboards section, #5219; scrubby labels: the Control bar's Stroke: and Opacity: links and the Properties panel's Stroke link scrub their fields, #4088; Properties: Quick Actions has Repeat Options for one selected repeat, #5181; Direct Selection: Shift-click picks several blend spine points, which drag together, #5285; Direct Selection: Cmd/Ctrl held lends the Selection tool and shows its bounding box, #3901; Join tool trims two crossing open paths and joins them at the crossing, #5844; Control bar: Paragraph: link and Align left/center/right while type is selected, #5372; shape tools: a press on the selection's centre point moves it and one in the rotate zone outside a box corner turns it, #5477; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x; Units › East Asian Type acts, with Q and Ha units; scores unchanged) > > Tech Circuit update (2026-11-14): three original procedural brushes; ten built-in brush libraries (G5). >