Accessibility: the isolation bar's back arrow, crumbs and pattern buttons have screen-reader names

The isolation bar drew its back arrow, the crumbs of the levels above and
the pattern editing buttons as bare Tab stops with no name or role.

Each is now a button. The back arrow is named for what it does: Back One
Level, Exit Isolation Mode, Exit Symbol Editing Mode, or Done while a
pattern is edited. A crumb is named with the name it shows, and Save a
Copy, Done and Cancel with their labels, all in the UI's language. The
strings already have rows in every catalog.
This commit is contained in:
dotCooCoo committed 2026-11-21 04:36:33 -08:00
1 parent 9fff48d88f
commit 1157d8ab51
3 files changed
+107 -3

No files matched your search

+25 -3
View File
@@ -432,8 +432,30 @@ pub fn isolation_bar(app: &mut VectorcraftApp, ui: &mut Ui, area: egui::Rect) {
// the levels above and the pattern buttons leaves isolation mode.
let background = ui.interact(bar, ui.scope_id().with("iso-bar"), Sense::CLICK | Sense::DRAG);
ui.painter().rect_filled(bar, 0.0, t.panel);
// The back arrow goes up one level: the isolated object's parent group, or `object.exitIsolation`,
// which goes from an isolated sublayer to its parent layer, from a group in a symbol's art to
// the symbol's layer, and otherwise leaves isolation mode. While a pattern is edited it is Done.
// Screen readers call it by what it does.
let parent_group = ancestry.iter().rev().nth(1).copied().filter(|p| st.doc.node(*p).is_some_and(|n| !n.is_layer()));
let symbol_layer = st.doc.symbol_edit.as_ref().map(|e| e.layer);
let up_one = parent_group.is_some()
|| symbol_layer.is_some_and(|l| l != iso && ancestry.contains(&l))
|| (st.doc.mask_edit.is_none()
&& symbol_layer.is_none()
&& st.doc.node(iso).is_some_and(|n| n.is_layer())
&& st.doc.parent_of(iso).is_some_and(|p| st.doc.is_editable(p)));
let back_name = if pattern_edit.is_some() {
tl!("Done")
} else if up_one {
tl!("Back One Level")
} else if symbol_layer == Some(iso) {
tl!("Exit Symbol Editing Mode")
} else {
tl!("Exit Isolation Mode")
};
let back = egui::Rect::from_min_size(bar.min + vec2(6.0, 3.0), vec2(18.0, 18.0));
let bresp = ui.interact(back, ui.scope_id().with("iso-back"), Sense::click());
bresp.widget_info(|| egui::WidgetInfo::labeled(egui::Role::Button, ui.is_enabled(), back_name));
icons::paint(ui, "chevron-left", back, if bresp.hovered() { t.text } else { t.icon });
let mut x = bar.left() + 30.0;
@@ -449,6 +471,7 @@ pub fn isolation_bar(app: &mut VectorcraftApp, ui: &mut Ui, area: egui::Rect) {
if !is_leaf {
let crumb_rect = egui::Rect::from_min_max(egui::pos2(x - 3.0, bar.top() + 3.0), egui::pos2(x + w + 3.0, bar.bottom() - 3.0));
let resp = ui.interact(crumb_rect, ui.scope_id().with(("iso-crumb", i)), Sense::click());
resp.widget_info(|| egui::WidgetInfo::labeled(egui::Role::Button, ui.is_enabled(), &crumb.name));
if resp.hovered() {
ui.painter().rect_filled(crumb_rect, 3.0, t.hover);
}
@@ -480,6 +503,7 @@ pub fn isolation_bar(app: &mut VectorcraftApp, ui: &mut Ui, area: egui::Rect) {
let w = 12.0 + 7.0 * label.len() as f32;
let r = egui::Rect::from_min_max(egui::pos2(x - w, bar.top() + 3.0), egui::pos2(x, bar.bottom() - 3.0));
let resp = ui.interact(r, ui.scope_id().with(("pat-bar", cmd)), Sense::click());
resp.widget_info(|| egui::WidgetInfo::labeled(egui::Role::Button, ui.is_enabled(), label));
ui.painter().rect_filled(r, 3.0, if resp.hovered() { t.hover } else { t.panel });
ui.painter().rect_stroke(r, 3.0, Stroke::new(1.0, t.button_border), egui::StrokeKind::Inside);
ui.painter().text(r.center(), egui::Align2::CENTER_CENTER, label, egui::FontId::proportional(12.0), t.text);
@@ -492,9 +516,7 @@ pub fn isolation_bar(app: &mut VectorcraftApp, ui: &mut Ui, area: egui::Rect) {
if bresp.clicked() {
pattern_cmd = pattern_cmd.or(pattern_edit.as_ref().map(|_| "object.pattern.done"));
if pattern_cmd.is_none() {
// Up one level: the isolated object's parent group, or `object.exitIsolation`, which
// goes from an isolated sublayer to its parent layer and otherwise leaves isolation mode.
nav_cmd = Some(match ancestry.iter().rev().nth(1).filter(|p| st.doc.node(**p).is_some_and(|n| !n.is_layer())) {
nav_cmd = Some(match parent_group {
Some(parent) => ("object.isolate", json!({ "id": parent.0 })),
None => ("object.exitIsolation", json!({})),
});
+81
View File
@@ -2264,6 +2264,87 @@ fn tab_skips_the_isolation_bars_background() {
assert!(!stops.contains(&bar), "{stops:?}");
}
/// Screen readers call the isolation bar's back arrow by what it does, each crumb of the levels
/// above by the name it shows, and the pattern buttons by their labels, in the UI's language. The
/// current object's name is not a button.
#[test]
fn the_isolation_bars_controls_have_screen_reader_names() {
use vectorcraft_doc::NodeId;
let mut app = crate::VectorcraftApp::new(Session::new(), Default::default());
app.run("file.new", json!({"width": 400, "height": 200})).unwrap();
let rect = |app: &mut crate::VectorcraftApp, x: f64| {
app.run("shape.rectangle", json!({"x": x, "y": 10, "width": 30, "height": 20})).unwrap()["id"].as_u64().unwrap()
};
let (a, b) = (rect(&mut app, 10.0), rect(&mut app, 50.0));
app.run("select.set", json!({"ids": [a, b]})).unwrap();
app.run("object.group", json!({})).unwrap();
let ctx = egui::Context::default();
crate::theme::install_fonts(&ctx);
ctx.enable_accesskit();
let buttons = |app: &mut crate::VectorcraftApp| {
let screen = egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(1200.0, 700.0));
let mut out = ctx.run_ui(egui::RawInput { screen_rect: Some(screen), ..Default::default() }, |ui| super::isolation_bar(app, ui, screen));
out.textures_delta.clear();
let nodes = out.platform_output.accesskit_update.map(|u| u.nodes).unwrap_or_default();
let mut names: Vec<String> =
nodes.iter().filter(|(_, n)| n.role() == egui::accesskit::Role::Button).filter_map(|(_, n)| n.label().map(str::to_string)).collect();
names.sort();
names
};
let name = |app: &crate::VectorcraftApp, id: NodeId| app.session.active().unwrap().doc.node(id).unwrap().display_name();
let st = app.session.active().unwrap();
let (layer, group) = (st.doc.layer_of(NodeId(a)).unwrap(), st.doc.parent_of(NodeId(a)).unwrap());
let (layer_name, group_name) = (name(&app, layer), name(&app, group));
// A path in a group: back goes to the group.
app.run("object.isolate", json!({"id": a})).unwrap();
let mut want = vec!["Back One Level".to_string(), layer_name.clone(), group_name.clone()];
want.sort();
assert_eq!(buttons(&mut app), want, "the current object's name is not a button");
// The group itself: back leaves isolation mode.
app.run("object.isolate", json!({"id": group.0})).unwrap();
let mut want = vec!["Exit Isolation Mode".to_string(), layer_name.clone()];
want.sort();
assert_eq!(buttons(&mut app), want);
// An isolated sublayer: back goes to its parent layer, and from the top-level layer it leaves.
let sub = app.run("layer.newSublayer", json!({"parent": layer.0, "name": "Sublayer B"})).unwrap()["id"].as_u64().unwrap();
app.run("object.isolate", json!({"id": sub})).unwrap();
let mut want = vec!["Back One Level".to_string(), layer_name.clone()];
want.sort();
assert_eq!(buttons(&mut app), want);
app.run("object.isolate", json!({"id": layer.0})).unwrap();
assert_eq!(buttons(&mut app), vec!["Exit Isolation Mode".to_string()]);
app.run("object.isolate", json!({"id": group.0})).unwrap();
// In German.
crate::i18n::set_current(crate::i18n::Lang::from_code("de").expect("de registered"));
let german = buttons(&mut app);
crate::i18n::set_current(crate::i18n::Lang::EN);
assert!(german.contains(&"Isolationsmodus beenden".to_string()), "{german:?}");
app.run("object.exitIsolation", json!({"all": true})).unwrap();
// Pattern editing: back is Done, beside Save a Copy, Done and Cancel.
let c = rect(&mut app, 200.0);
app.run("select.set", json!({"ids": [c]})).unwrap();
app.run("object.pattern.make", json!({"name": "Dots", "width": 20, "height": 20})).unwrap();
let names = buttons(&mut app);
for label in ["Save a Copy", "Cancel"] {
assert!(names.contains(&label.to_string()), "{label} in {names:?}");
}
assert_eq!(names.iter().filter(|n| *n == "Done").count(), 2, "{names:?}");
app.run("object.pattern.cancel", json!({})).unwrap();
// Symbol editing mode: back leaves it.
let d = rect(&mut app, 300.0);
app.run("select.set", json!({"ids": [d]})).unwrap();
app.run("symbol.new", json!({"name": "Box"})).unwrap();
app.run("symbol.edit", json!({"name": "Box"})).unwrap();
let names = buttons(&mut app);
assert!(names.contains(&"Exit Symbol Editing Mode".to_string()), "{names:?}");
}
/// The Control bar's Isolate Selected Object isolates a path inside a group that Direct
/// Selection selected, and Exit Isolation Mode leaves with the path selected. Type, symbol
/// instances, blends, two objects and an envelope's contents get no isolate button, and pattern
+1
View File
@@ -1321,6 +1321,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur
- The canvas context menu has Isolate Selected Path (`object.isolate`) when the selection is one path, a path selected inside a group or a compound path included, as the [help page](https://web.archive.org/web/20210601162814/https://helpx.adobe.com/pdf/illustrator_reference.pdf#page=324) lists it beside Isolate Selected Group. As VectorCraft's own rule, neither item shows for two or more objects, or for an object `object.isolate` refuses: a hidden or locked object, one in a hidden or locked group or layer, a guide while Lock Guides is on, and, while a symbol is edited, an object outside the symbol's art (`single_path_context_item_enters_isolation`, `isolation_context_item_follows_selected_kind`, `isolation_context_item_skips_objects_that_cannot_be_isolated`).
- While an opacity mask is edited, Exit Isolation Mode (Esc, the isolation bar's back arrow, the Control bar's button, and the Layers panel menu's and canvas context menu's Exit Isolation Mode) leaves mask editing as Stop Editing Opacity Mask does, in one undo step: the mask keeps the edits, and the masked object is selected. While a pattern is edited, the Exit Isolation Mode item of the Layers panel menu and of the canvas context menu saves the pattern and leaves pattern editing, as Done does.
- A click anywhere on the isolation bar, the isolated object's name included, outside its back arrow, the breadcrumbs of the levels above and its buttons leaves isolation mode altogether, nested isolation included, as Exit Isolation Mode does ([the help page](https://help.adobe.com/archive/en_US/illustrator/cs4/illustrator_cs4_help.pdf#page=207)). As VectorCraft's own rules, the click stops editing an opacity mask, leaves symbol editing mode even while a group inside the symbol's art is isolated, together with the isolation the mode was entered from, and does nothing while a pattern is edited; a drag across the bar does not leave (`isolation_bar_background_click_exits_nested_isolation`).
- Screen readers read the isolation bar's back arrow as a button named for what it does (Back One Level, Exit Isolation Mode, Exit Symbol Editing Mode, or Done while a pattern is edited), each crumb of the levels above as a button with the name it shows, and Save a Copy, Done and Cancel by their labels, in the UI's language (`the_isolation_bars_controls_have_screen_reader_names`).
- In isolation mode the Layers panel lists only the art of the isolated layer, sublayer or group, and lists the other layers and groups again when isolation mode ends ([the help page](https://help.adobe.com/archive/en_US/illustrator/cs5/illustrator_cs5_help.pdf#page=212)). As VectorCraft's own rules, the isolated layer, sublayer, group or object is the top row and opens on entering, the panel scrolls back to its row on leaving, search and filter look only inside it, nothing is dropped beside its row or into the empty space under the rows, Rename and Locate Object open no rows outside it, and rows highlighted outside it are no longer highlighted. With no row highlighted, Delete Selection and the trash do not delete a current layer outside it. New Layer, New Sublayer and Duplicate (in the panel menu and a row's context menu) are off, and OK in New Layer Options is an error, while the layer or copy they make would be outside it (`isolation_lists_only_the_isolated_art_and_exit_lists_every_layer_again`, `isolation_opens_the_isolated_row_and_keeps_drops_inside_it`, `isolation_drops_highlights_outside_the_isolated_art`, `isolation_keeps_rename_and_locate_to_the_rows_listed`, `isolation_keeps_delete_to_the_rows_listed`, `isolation_keeps_new_layers_to_the_rows_listed`, `new_layer_options_ok_checks_isolation_again`).
- With a sublayer isolated, Exit Isolation Mode (the Layers panel menu item, the isolation bar's back arrow, the Control bar button and `object.exitIsolation`) goes back one layer at a time, isolating the parent layer, and leaves isolation mode from the top-level layer, as the [help page](https://helpx.adobe.com/illustrator/desktop/manage-objects/select-objects/isolate-objects.html) and an archived [help page](https://help.adobe.com/archive/en_US/illustrator/cs5/illustrator_cs5_help.pdf#page=213) describe. As VectorCraft's own rules, Esc and the top-level layer's crumb leave isolation mode from a sublayer at any depth (`object.exitIsolation {all: true}`), a sublayer's crumb isolates that sublayer, a hidden or locked parent layer is not isolated, and a step up records no undo step (`exit_isolation_goes_up_one_layer_from_a_sublayer`, `isolation_bar_back_button_steps_up_through_sublayers`, `escape_leaves_an_isolated_sublayer_in_one_step`).
- Numeric spinner arrows keep stepping while held with the mouse past the click timeout and stop on release (#6307; `a_held_spinner_arrow_repeats`).