From 7e5f66bdacb703fb888e63e6a7ba8c783a04d716 Mon Sep 17 00:00:00 2001 From: squalorso <316661546+squalorso@users.noreply.github.com> Date: Sun, 1 Nov 2026 00:46:43 +0100 Subject: [PATCH 1/7] Screen readers: formatting shortcuts say what they did, as Word does After a keyboard shortcut for Bold, Italic, Underline, Subscript or Superscript, an alignment or the font size, WordCraft announces what it did in a polite live region, in the words Word uses: "Bold On", "Bold Off", "Center On", "Font 14 pt". Each announcement is a new node, so the same words twice are heard twice, and it stays three seconds. Ribbon clicks aren't announced: their buttons say their state. Co-Authored-By: Claude Opus 5.5 --- ROADMAP.md | 5 +- crates/ui-egui/src/announce.rs | 175 +++++++++++++++++++++++++++ crates/ui-egui/src/app.rs | 1 + crates/ui-egui/src/app/frame.rs | 1 + crates/ui-egui/src/keys/shortcuts.rs | 5 +- crates/ui-egui/src/lib.rs | 3 + crates/ui-egui/src/window_ui.rs | 2 + docs/gaps.md | 3 +- docs/ui-parity.md | 5 +- 9 files changed, 195 insertions(+), 5 deletions(-) create mode 100644 crates/ui-egui/src/announce.rs diff --git a/ROADMAP.md b/ROADMAP.md index 90c51e17dc..c40fb45562 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -4,7 +4,7 @@ **Stage: alpha** · next: beta, ~15 points (60% → 75% ready for real work) and ~150–230 h away -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-31 · **Change:** trivial (progress log: a paragraph naming an undefined style is formatted as Normal, #5077); previously trivial (progress log: TOC page numbers as PAGEREF fields, #5097); previously trivial (progress log: Backstage keytips, #4960); previously trivial (Progress log: only the printer's PDF leaves out links; Save these pages as PDF keeps them, #4734); previously trivial (progress log: Chinese and Japanese text counts a word per character, #4547; previously trivial: aligned-copy review fixes retain the document axis through scrolling and include secondary selections (#4764)); previously trivial (connector rerouting indexes laid-out object positions once per batch (#3631); previously trivial (progress log: corporate authors in bibliographies, #4848); previously trivial (custom-property bookmark-link preservation, #4767); previously trivial (progress log: Table Properties follows the selection, #4857); previously trivial (Relative font-size commands preserve mixed sizes in the selection (#4903); existing button steps and one-point shortcuts are unchanged; readiness estimates unchanged); previously trivial (Arabic Backspace removes one combining mark and keeps its base letter (#4757); previously trivial (note conversion walks reference offsets and formatting runs together, #4750); previously trivial (DOCX comment-ID save lookups); previously trivial (progress log: RTF pictures stored as Windows or Enhanced Metafiles are imported, #4259); previously trivial (#4658 bounds nested Markdown reference-label work); previously trivial (HTML import keeps preformatted lines with CR or CRLF input newlines, #4810); previously trivial (progress log: Insert › Shapes icon grid, #4349); previously trivial (progress log: AutoCorrect Options with no document open, #4585); previously trivial (progress log: window fallback geometry and equation symbol tooltips); previously trivial (progress log: window titles omit NUL characters, #3634); previously trivial (Recipient labels continue across product-sized sheets instead of stopping after the first sheet (#4880)); previously trivial (progress log: Custom document properties dialog, #2982; previously trivial: progress log: View › New Window; previously trivial: progress log: interface translations come from storytold/craft-i18n through the `craft-i18n` crate; previously trivial: progress log: disabled-control reasons translated in every interface language, #2678; previously trivial: progress log: mail merge record navigation and record ranges for printing, #3028; previously trivial: selection bar for right-to-left paragraphs and table rows; previously trivial: group connector rerouting preserves rotated and flipped free or unresolved endpoints under nonuniform group scaling; readiness estimates unchanged; previously trivial: progress log: a word with no break opportunity in it no longer makes the layout quadratic, #3412; previously trivial: progress log: a relationship the markup names without the prefix is read as it wrote, and an ordinary `id` names no part; previously trivial: progress log: a document with many relationships opens in the time its part takes, and an id the text only mentions is not a reference, #3411; previously trivial: progress log: read only and comments-only protection grey out edits; previously trivial: progress log: an empty paragraph with a hidden mark shows nothing, not even its list number, #3982; previously trivial: progress log: "NaN" in the Font dialog's Size box no longer closes the app, #3663; previously trivial: progress log: a table cell span from a `.json` file no longer overflows, #3637; previously trivial: progress log: a click in the footer while editing the header moves there; previously trivial: explicit documents keep the editor when recovery discovery finishes; readable recovery controls; previously trivial: Slovenian interface catalog, 2,614 entries; previously trivial: Insert Table of Figures dialog for any caption label, #3013; previously trivial: progress log: Home › Underline drop-down, #2738; previously trivial: personal templates in File › New and Save as Word Template, #2852; previously trivial: progress log: the scrollbar page tip stays on one line, #3341; previously trivial: progress log: forms protection greys out the control buttons; previously trivial: progress log: a document with many content controls saves in the time the controls take, #13; previously trivial: progress log: Word signature lines kept on save; previously trivial: a Thai run with Latin finds one installed font covering it all on Linux too, #1549; previously trivial: progress log: closing the header returns to the body selection, #3331; previously trivial: progress log: saving to a NAS share mounted by GVFS, #3003; previously trivial: progress log: a picture dragged near the bottom of a page lands there, #3169; previously trivial: centred list labels after leading page breaks, #2964; previously trivial: progress log: inline pictures drag to an insertion cursor and stay inline, #2233, #2234; previously trivial: progress log: a text file saved over itself closes without asking, #2376; previously trivial: progress log: a text frame in the paragraph defaults frames nothing, #2360; previously trivial: fixed font inputs in four layout controls; previously trivial: typing no longer starts render threads on every repaint, #3027; previously trivial: a right, centre or decimal tab whose text doesn't fit, or a left tab past the right indent, goes to the next line with its text, #1840; previously trivial: progress log: banded rows shade as in Word, #3415; previously trivial: progress log: the table handles show while the caret is in the table, #2428; previously trivial: progress log: a click below a floating table reaches the text after it, #2038; previously trivial: progress log: Delete on selected table cells leaves one empty paragraph in each, #2802; previously trivial: progress log: lam-alef in exported PDFs extracts whole with fonts that draw it as two glyphs, #2310; previously trivial: Bullets and Numbering toggle off style-inherited lists at their effective level, including basedOn chains and numbered ListParagraph styles; other paragraphs and list definitions stay unchanged (related to #3459); previously trivial: Russian sorting keeps ё with е and recognises decomposed ё/й; previously trivial: progress log: a text box that keeps the keyboard no longer resets the input method every frame, #2986; previously trivial: progress log: recovery copies and .json files store pictures as base64, #586 follow-up; previously trivial: progress log: legacy menu keys, #1697; previously trivial: progress log: shape gradients and transparency, #1500; previously trivial: progress log: Focus fills the screen, and Full Screen View shows the pages alone, #1678; previously trivial: progress log: text above a float's anchor wraps around it, #2048; previously trivial: progress log: File › Recover follows the app theme, #3243; previously trivial: progress log: formatting toolbar with the text context menu, #2959; previously trivial: progress log: caret inside ligatures, #1974; previously trivial: text typed into a content control takes the control's formatting; localized placeholder styles recognised; previously trivial: forms protection keeps its content controls: no inserting, Properties or Remove Content Control; previously trivial: long navigation headings wrap onto further lines within the pane, #3015; previously trivial: clearing a no-match font query keeps the recent heading visible, #2068; previously trivial: a word after a slash wraps whole, like Word, #2963; previously trivial: progress log: a header-cell picture watermark sits behind the text, #1775; previously trivial: symbols keep their font when the text font changes, #2036; previously trivial: opening a DOCX no longer copies its pictures; previously trivial: Add Font imports every selected font file, #1789); previously trivial (RTF export writes sections (gap 19); previously trivial: ODT export writes sections (gap 19); previously trivial: Read Aloud speaks each sentence in its own language, #1843; previously trivial: hint-reliant CJK outlines; previously trivial: Ctrl+wheel zoom no longer scrolls the document, #1743; previously trivial: progress log: Turkish case mapping in AutoCorrect, #1923; previously trivial: a mouse drag on a table leaves the view where it is, #1738; previously trivial: progress log: Hebrew field results and smart quotes, #1670; previously trivial: Backspace removes a selected table, rows or columns, #1844; previously trivial: progress log: mixed Hebrew/Latin text keeps its order in Word, #1543; previously trivial: progress log: web typing in non-Latin text no longer repeats, #1480; previously trivial: progress log: font family caches bounded and math font lookups follow font changes, #1354; previously trivial: `-->` AutoCorrect replacement, #2223; previously trivial: numbered headings, #1793; previously trivial: Navigation Find exposes Results, #2096; previously trivial: progress log: Columns on selected text, #2024; previously trivial: progress log: legacy outline, shadow, emboss and imprint text effects drawn, #2534; previously trivial: progress log: Indonesian proofing, #498; previously trivial: progress log: DOCX glossary documents (building blocks); previously trivial: progress log: Read Mode keeps the keyboard and shows whole, unobscured columns, #1772); previously trivial: progress log: font list entries of tall-ascent fonts no longer cut off, #2570); previously trivial: progress log: Split Cells and Convert Text to Table dialogs follow the Word check, #2592; previously trivial: a new source's Tag is made like Word's, three letters of the author and two digits of the year with a number added when taken, and an edit keeps the Tag, #2094; previously trivial: Web Layout fills the window width, #1876; previously trivial: progress log: Different First Page headers reachable from page 1, #2826; previously trivial: Language dialog keeps inherited proofing language and no-proof choices (#2717); previously trivial: progress log: web preferences kept between visits, #2132; previously trivial: progress log: undrawable private-use list bullets show the level's default bullet, #1683; previously trivial: progress log: `w:eastAsianLayout` kept on save; previously trivial: table style editor formats every part, #714); previously trivial: VML freeforms read and kept on save; previously trivial: progress log: consistent preferred cell widths; previously trivial: multi-paragraph field instructions no longer add blank lines; previously trivial: page-break-only list paragraphs hide their labels; previously trivial: progress log: grouped `flowChartOr` shapes draw their circle and crossing spokes; previously trivial: progress log: copies keep their formatting in other programs, #1523; previously trivial: progress log: privacy options on save, #1062; previously trivial: progress log: equation pictures in theme colours on Windows, #1002; previously trivial: symbol fonts, #776; previously trivial: the save prompt answers from the keyboard, #861; previously trivial: table column and row markers on the rulers, #700; previously trivial: table borders and the resize handle drag on the page, #217; previously trivial: formatting revisions landed, #41; previously trivial: Draw tab ink, #307, and Draw Table and Eraser, #303, landed: catalog 402/434; previously minor: readiness table with hours per audience; full number back to the additive weighted sum, 60%; mainstream and essentials numbers added; alpha gate checked; previously major: full re-measure against Word for Mac 16.113.4; progress docs restructured) · **Target:** Microsoft Word (Microsoft 365) for Mac 16.113.4 +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-01 · **Change:** trivial (formatting shortcuts say what they did to screen readers); previously trivial (progress log: a paragraph naming an undefined style is formatted as Normal, #5077); previously trivial (progress log: TOC page numbers as PAGEREF fields, #5097); previously trivial (progress log: Backstage keytips, #4960); previously trivial (Progress log: only the printer's PDF leaves out links; Save these pages as PDF keeps them, #4734); previously trivial (progress log: Chinese and Japanese text counts a word per character, #4547; previously trivial: aligned-copy review fixes retain the document axis through scrolling and include secondary selections (#4764)); previously trivial (connector rerouting indexes laid-out object positions once per batch (#3631); previously trivial (progress log: corporate authors in bibliographies, #4848); previously trivial (custom-property bookmark-link preservation, #4767); previously trivial (progress log: Table Properties follows the selection, #4857); previously trivial (Relative font-size commands preserve mixed sizes in the selection (#4903); existing button steps and one-point shortcuts are unchanged; readiness estimates unchanged); previously trivial (Arabic Backspace removes one combining mark and keeps its base letter (#4757); previously trivial (note conversion walks reference offsets and formatting runs together, #4750); previously trivial (DOCX comment-ID save lookups); previously trivial (progress log: RTF pictures stored as Windows or Enhanced Metafiles are imported, #4259); previously trivial (#4658 bounds nested Markdown reference-label work); previously trivial (HTML import keeps preformatted lines with CR or CRLF input newlines, #4810); previously trivial (progress log: Insert › Shapes icon grid, #4349); previously trivial (progress log: AutoCorrect Options with no document open, #4585); previously trivial (progress log: window fallback geometry and equation symbol tooltips); previously trivial (progress log: window titles omit NUL characters, #3634); previously trivial (Recipient labels continue across product-sized sheets instead of stopping after the first sheet (#4880)); previously trivial (progress log: Custom document properties dialog, #2982; previously trivial: progress log: View › New Window; previously trivial: progress log: interface translations come from storytold/craft-i18n through the `craft-i18n` crate; previously trivial: progress log: disabled-control reasons translated in every interface language, #2678; previously trivial: progress log: mail merge record navigation and record ranges for printing, #3028; previously trivial: selection bar for right-to-left paragraphs and table rows; previously trivial: group connector rerouting preserves rotated and flipped free or unresolved endpoints under nonuniform group scaling; readiness estimates unchanged; previously trivial: progress log: a word with no break opportunity in it no longer makes the layout quadratic, #3412; previously trivial: progress log: a relationship the markup names without the prefix is read as it wrote, and an ordinary `id` names no part; previously trivial: progress log: a document with many relationships opens in the time its part takes, and an id the text only mentions is not a reference, #3411; previously trivial: progress log: read only and comments-only protection grey out edits; previously trivial: progress log: an empty paragraph with a hidden mark shows nothing, not even its list number, #3982; previously trivial: progress log: "NaN" in the Font dialog's Size box no longer closes the app, #3663; previously trivial: progress log: a table cell span from a `.json` file no longer overflows, #3637; previously trivial: progress log: a click in the footer while editing the header moves there; previously trivial: explicit documents keep the editor when recovery discovery finishes; readable recovery controls; previously trivial: Slovenian interface catalog, 2,614 entries; previously trivial: Insert Table of Figures dialog for any caption label, #3013; previously trivial: progress log: Home › Underline drop-down, #2738; previously trivial: personal templates in File › New and Save as Word Template, #2852; previously trivial: progress log: the scrollbar page tip stays on one line, #3341; previously trivial: progress log: forms protection greys out the control buttons; previously trivial: progress log: a document with many content controls saves in the time the controls take, #13; previously trivial: progress log: Word signature lines kept on save; previously trivial: a Thai run with Latin finds one installed font covering it all on Linux too, #1549; previously trivial: progress log: closing the header returns to the body selection, #3331; previously trivial: progress log: saving to a NAS share mounted by GVFS, #3003; previously trivial: progress log: a picture dragged near the bottom of a page lands there, #3169; previously trivial: centred list labels after leading page breaks, #2964; previously trivial: progress log: inline pictures drag to an insertion cursor and stay inline, #2233, #2234; previously trivial: progress log: a text file saved over itself closes without asking, #2376; previously trivial: progress log: a text frame in the paragraph defaults frames nothing, #2360; previously trivial: fixed font inputs in four layout controls; previously trivial: typing no longer starts render threads on every repaint, #3027; previously trivial: a right, centre or decimal tab whose text doesn't fit, or a left tab past the right indent, goes to the next line with its text, #1840; previously trivial: progress log: banded rows shade as in Word, #3415; previously trivial: progress log: the table handles show while the caret is in the table, #2428; previously trivial: progress log: a click below a floating table reaches the text after it, #2038; previously trivial: progress log: Delete on selected table cells leaves one empty paragraph in each, #2802; previously trivial: progress log: lam-alef in exported PDFs extracts whole with fonts that draw it as two glyphs, #2310; previously trivial: Bullets and Numbering toggle off style-inherited lists at their effective level, including basedOn chains and numbered ListParagraph styles; other paragraphs and list definitions stay unchanged (related to #3459); previously trivial: Russian sorting keeps ё with е and recognises decomposed ё/й; previously trivial: progress log: a text box that keeps the keyboard no longer resets the input method every frame, #2986; previously trivial: progress log: recovery copies and .json files store pictures as base64, #586 follow-up; previously trivial: progress log: legacy menu keys, #1697; previously trivial: progress log: shape gradients and transparency, #1500; previously trivial: progress log: Focus fills the screen, and Full Screen View shows the pages alone, #1678; previously trivial: progress log: text above a float's anchor wraps around it, #2048; previously trivial: progress log: File › Recover follows the app theme, #3243; previously trivial: progress log: formatting toolbar with the text context menu, #2959; previously trivial: progress log: caret inside ligatures, #1974; previously trivial: text typed into a content control takes the control's formatting; localized placeholder styles recognised; previously trivial: forms protection keeps its content controls: no inserting, Properties or Remove Content Control; previously trivial: long navigation headings wrap onto further lines within the pane, #3015; previously trivial: clearing a no-match font query keeps the recent heading visible, #2068; previously trivial: a word after a slash wraps whole, like Word, #2963; previously trivial: progress log: a header-cell picture watermark sits behind the text, #1775; previously trivial: symbols keep their font when the text font changes, #2036; previously trivial: opening a DOCX no longer copies its pictures; previously trivial: Add Font imports every selected font file, #1789); previously trivial (RTF export writes sections (gap 19); previously trivial: ODT export writes sections (gap 19); previously trivial: Read Aloud speaks each sentence in its own language, #1843; previously trivial: hint-reliant CJK outlines; previously trivial: Ctrl+wheel zoom no longer scrolls the document, #1743; previously trivial: progress log: Turkish case mapping in AutoCorrect, #1923; previously trivial: a mouse drag on a table leaves the view where it is, #1738; previously trivial: progress log: Hebrew field results and smart quotes, #1670; previously trivial: Backspace removes a selected table, rows or columns, #1844; previously trivial: progress log: mixed Hebrew/Latin text keeps its order in Word, #1543; previously trivial: progress log: web typing in non-Latin text no longer repeats, #1480; previously trivial: progress log: font family caches bounded and math font lookups follow font changes, #1354; previously trivial: `-->` AutoCorrect replacement, #2223; previously trivial: numbered headings, #1793; previously trivial: Navigation Find exposes Results, #2096; previously trivial: progress log: Columns on selected text, #2024; previously trivial: progress log: legacy outline, shadow, emboss and imprint text effects drawn, #2534; previously trivial: progress log: Indonesian proofing, #498; previously trivial: progress log: DOCX glossary documents (building blocks); previously trivial: progress log: Read Mode keeps the keyboard and shows whole, unobscured columns, #1772); previously trivial: progress log: font list entries of tall-ascent fonts no longer cut off, #2570); previously trivial: progress log: Split Cells and Convert Text to Table dialogs follow the Word check, #2592; previously trivial: a new source's Tag is made like Word's, three letters of the author and two digits of the year with a number added when taken, and an edit keeps the Tag, #2094; previously trivial: Web Layout fills the window width, #1876; previously trivial: progress log: Different First Page headers reachable from page 1, #2826; previously trivial: Language dialog keeps inherited proofing language and no-proof choices (#2717); previously trivial: progress log: web preferences kept between visits, #2132; previously trivial: progress log: undrawable private-use list bullets show the level's default bullet, #1683; previously trivial: progress log: `w:eastAsianLayout` kept on save; previously trivial: table style editor formats every part, #714); previously trivial: VML freeforms read and kept on save; previously trivial: progress log: consistent preferred cell widths; previously trivial: multi-paragraph field instructions no longer add blank lines; previously trivial: page-break-only list paragraphs hide their labels; previously trivial: progress log: grouped `flowChartOr` shapes draw their circle and crossing spokes; previously trivial: progress log: copies keep their formatting in other programs, #1523; previously trivial: progress log: privacy options on save, #1062; previously trivial: progress log: equation pictures in theme colours on Windows, #1002; previously trivial: symbol fonts, #776; previously trivial: the save prompt answers from the keyboard, #861; previously trivial: table column and row markers on the rulers, #700; previously trivial: table borders and the resize handle drag on the page, #217; previously trivial: formatting revisions landed, #41; previously trivial: Draw tab ink, #307, and Draw Table and Eraser, #303, landed: catalog 402/434; previously minor: readiness table with hours per audience; full number back to the additive weighted sum, 60%; mainstream and essentials numbers added; alpha gate checked; previously major: full re-measure against Word for Mac 16.113.4; progress docs restructured) · **Target:** Microsoft Word (Microsoft 365) for Mac 16.113.4 > **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-29 · **Change:** trivial (Recipient labels continue across product-sized sheets instead of stopping after the first sheet (#4880)); previously trivial (English dialects in proofing, #1281; previously trivial: triple borders draw three lines, #1740; previously trivial: progress log: double-clicking a later page's footer no longer scrolls up, #2103; previously trivial: long navigation headings wrap onto further lines within the pane, #3015; previously trivial: clearing a no-match font query keeps the recent heading visible, #2068; previously trivial: a word after a slash wraps whole, like Word, #2963; previously trivial: RTF export writes sections (gap 19); previously trivial: ODT export writes sections (gap 19); previously trivial: progress log: pasted blockquotes are indented paragraphs, #1270; previously trivial: progress log: print-area strings translated in every catalog; previously trivial: progress log: comments readable in the dark theme, #2045; previously trivial: progress log: ODT sections, #1379; previously trivial: progress log: table deletes, Change Case and Unlink Fields respect Track Changes and locked content controls, #1329; previously trivial: progress log: rounded rectangle corners, #1476; previously trivial: progress log: Save As type list, #1399; previously trivial: progress log: privacy options on save, #1062; previously trivial: progress log: equation pictures in theme colours on Windows, #1002; previously trivial: symbol fonts, #776; previously trivial: the save prompt answers from the keyboard, #861; previously trivial: table column and row markers on the rulers, #700; previously trivial: table borders and the resize handle drag on the page, #217; previously trivial: formatting revisions landed, #41; previously trivial: Draw tab ink, #307, and Draw Table and Eraser, #303, landed: catalog 402/434; previously minor: readiness table with hours per audience; full number back to the additive weighted sum, 60%; mainstream and essentials numbers added; alpha gate checked; previously major: full re-measure against Word for Mac 16.113.4; progress docs restructured) · **Target:** Microsoft Word (Microsoft 365) for Mac 16.113.4 > **Printing update:** 2026-10-12 · direct desktop printing through craft-print; details below. @@ -140,6 +140,8 @@ Ranked, to beta (detail and remaining milestones in [docs/roadmap.md](docs/roadm ## Progress log +- 2026-11-01: Screen readers: the formatting shortcuts say what they did, as Word does (Bold On, Bold Off, Center On, Font 14 pt), through a polite live region (checked with NVDA); before, Ctrl+B said nothing. + - 2026-10-31: DOCX: a paragraph naming a style the file doesn't define is formatted as Normal, as in Word, not with the document defaults alone, so a Pandoc footer naming an undefined `Footer` style is as tall as Word's and no longer pushes the last paragraph to the next page (#5077). Readiness unchanged. - 2026-10-31: A table of contents writes its page numbers as `PAGEREF` fields to the headings' bookmarks, as Word does, so updating the fields in Word moves the numbers with the headings; they were plain text (#5097). - 2026-10-31: Keytips reach the Backstage: Alt, F badges its pages with Word's letters, and Alt, F, P (or V) opens Print (#4960). @@ -680,6 +682,7 @@ Footer page-table height and body wrapping are corrected. Other pagination gaps | Date | Change | Summary | |---|---|---| +| 2026-11-01 | trivial | formatting shortcuts say what they did to screen readers | | 2026-10-31 | trivial | Progress log: a paragraph naming an undefined DOCX style is formatted as Normal (#5077) | | 2026-10-31 | trivial | Progress log: TOC page numbers are PAGEREF fields (#5097) | | 2026-10-31 | trivial | Progress log: Backstage keytips, Alt, F, P prints (#4960) | diff --git a/crates/ui-egui/src/announce.rs b/crates/ui-egui/src/announce.rs new file mode 100644 index 0000000000..e09e29dd35 --- /dev/null +++ b/crates/ui-egui/src/announce.rs @@ -0,0 +1,175 @@ +//! Screen readers: what a formatting shortcut did, said as Word says it ("Bold On", "Center Off", +//! "Font 14pt"). Word raises these itself; here they go through a polite live region, which +//! screen readers read when it appears. + +use egui::accesskit::{Live, Role}; +use serde_json::Value; +use wordcraft_doc::Align; + +use crate::WordApp; + +/// How long an announcement stays in the tree: a screen reader reads its name after the +/// live-region event, so it must still be there then. +const SHOWN_MS: f64 = 3000.0; + +/// An announcement for screen readers. Each one gets its own node, numbered: a live region is +/// read when it appears or its text changes, so the same text twice needs a new node. +#[derive(Clone, Debug)] +pub(crate) struct Announcement { + text: String, + serial: u64, + at: f64, +} + +/// Announces what the shortcut for command `id` did, once it has run; nothing for a command Word +/// doesn't announce. +pub(crate) fn after_shortcut(app: &mut WordApp, id: &str) { + let Some(text) = describe(app, id) else { return }; + let serial = app.announcement.as_ref().map_or(0, |a| a.serial.wrapping_add(1)); + app.announcement = Some(Announcement { text, serial, at: crate::now_ms() }); +} + +/// The words for what command `id` did: the command's name and whether its formatting is now on, +/// or the font size the selection now has. +fn describe(app: &WordApp, id: &str) -> Option { + let on_off = |name: &str, on: bool| format!("{name} {}", if on { tl!("On") } else { tl!("Off") }); + let state = || wordcraft_engine::cmd::format::state(&app.session); + let character = match id { + "format.bold" => Some(("bold", tl!("Bold"))), + "format.italic" => Some(("italic", tl!("Italic"))), + "format.underline" => Some(("underline", tl!("Underline"))), + "format.subscript" => Some(("subscript", tl!("Subscript"))), + "format.superscript" => Some(("superscript", tl!("Superscript"))), + _ => None, + }; + if let Some((key, name)) = character { + return Some(on_off(name, state().get(key).and_then(Value::as_bool).unwrap_or(false))); + } + let alignment = match id { + "para.alignLeft" => Some((Align::Left, tl!("Align Left"))), + "para.alignCenter" => Some((Align::Center, tl!("Center"))), + "para.alignRight" => Some((Align::Right, tl!("Align Right"))), + "para.justify" => Some((Align::Justify, tl!("Justify"))), + _ => None, + }; + if let Some((want, name)) = alignment { + // As the ribbon's buttons show it: Center twice centres, then goes back to the left. + let s = &app.session; + let align = s.doc.para_at(&s.sel.focus).map(|p| s.doc.styles.resolve_para(&p.props)).map(|r| r.align.visual(r.bidi)); + return Some(on_off(name, align == Some(want))); + } + if matches!(id, "format.growFont" | "format.shrinkFont" | "format.growFont1" | "format.shrinkFont1") { + // A selection of mixed sizes has no one size to say. + let size = state().get("size").and_then(Value::as_f64)?; + return Some(format!("{} {}", tl!("Font"), crate::options::length_in(wordcraft_geom::Unit::Points, size as f32))); + } + None +} + +/// Puts the latest announcement in the tree, as a polite live region, while it is fresh. +pub(crate) fn expose(app: &WordApp, ctx: &egui::Context) { + let Some(a) = &app.announcement else { return }; + let age = crate::now_ms() - a.at; + if !(0.0..SHOWN_MS).contains(&age) { + return; + } + ctx.accesskit_node_builder(egui::Id::unique(("announcement", a.serial)), |node| { + // A label's text is its value: that is the name screen readers read (UI Automation's + // live-region event goes only to a node with a name). + node.set_role(Role::Label); + node.set_live(Live::Polite); + node.set_value(a.text.clone()); + }); + // A frame when it's due to go, so it leaves the tree even while nothing else happens. + ctx.request_repaint_after(std::time::Duration::from_secs_f64((SHOWN_MS - age) / 1000.0)); +} + +#[cfg(test)] +mod tests { + use egui::accesskit::Live; + use egui::{Key, Modifiers}; + use egui_kittest::kittest::{NodeT, Queryable}; + use serde_json::json; + + use crate::WordApp; + + fn harness() -> egui_kittest::Harness<'static, WordApp> { + let mut app = WordApp::new(wordcraft_engine::Session::new(wordcraft_doc::Document::from_text("Lanterns glow")), crate::Services::default()); + app.canvas.want_focus = true; + let mut h = egui_kittest::Harness::builder().with_size(egui::vec2(1440.0, 900.0)).build_ui_state( + |ui, app: &mut WordApp| { + let ctx = ui.ctx().clone(); + app.logic(&ctx); + app.ui(ui); + }, + app, + ); + h.run_steps(6); + assert!(h.state().canvas.focused, "the page has the keyboard"); + h.state_mut().session.sel = wordcraft_engine::Selection { anchor: wordcraft_doc::Pos::body(0, 0), focus: wordcraft_doc::Pos::body(0, 8) }; + h.run_steps(2); + h + } + + /// The live region's text and node (its id, written out), if one is in the tree. The text is + /// the label's value, which is its name to screen readers. + fn heard(h: &egui_kittest::Harness<'_, WordApp>) -> Option<(String, String)> { + let node = h.query_by(|n| n.live() == Live::Polite)?; + let n = node.accesskit_node(); + assert!(n.label_comes_from_value(), "a label, named by its value"); + Some((n.value().unwrap_or_default(), format!("{:?}", n.id()))) + } + + fn press(h: &mut egui_kittest::Harness<'_, WordApp>, m: Modifiers, key: Key) -> Option<(String, String)> { + h.key_press_modifiers(m, key); + h.run_steps(2); + heard(h) + } + + /// Ctrl+B, Ctrl+I, Ctrl+U and the alignment keys say what they did, as Word does ("Bold On", + /// then "Bold Off"), each time in a new live region, so the same words twice are heard twice. + #[test] + fn formatting_shortcuts_say_what_they_did() { + let mut h = harness(); + assert_eq!(heard(&h), None, "nothing to say before a shortcut"); + let (text, first) = press(&mut h, Modifiers::COMMAND, Key::B).expect("Ctrl+B is announced"); + assert_eq!(text, "Bold On"); + let (text, second) = press(&mut h, Modifiers::COMMAND, Key::B).expect("again"); + assert_eq!(text, "Bold Off"); + assert_ne!(first, second, "each announcement is a new live region"); + for (key, said) in [ + (Key::I, "Italic On"), + (Key::U, "Underline On"), + (Key::E, "Center On"), + (Key::E, "Center Off"), + (Key::R, "Align Right On"), + (Key::J, "Justify On"), + (Key::L, "Align Left On"), + ] { + assert_eq!(press(&mut h, Modifiers::COMMAND, key).map(|(t, _)| t).as_deref(), Some(said), "{key:?}"); + } + let (_, before) = heard(&h).expect("the last one"); + let (text, again) = press(&mut h, Modifiers::COMMAND, Key::L).expect("Ctrl+L twice"); + assert_eq!(text, "Align Left On", "left alignment stays"); + assert_ne!(before, again, "the same words twice are a new live region, so they are heard again"); + let grown = press(&mut h, Modifiers::COMMAND | Modifiers::SHIFT, Key::Period).map(|(t, _)| t).expect("Ctrl+Shift+. is announced"); + assert!(grown.starts_with("Font ") && grown.ends_with(" pt"), "{grown}"); + } + + /// Only shortcuts are announced: a ribbon button says its own state, and a command that isn't + /// formatting says nothing. An announcement leaves the tree after three seconds. + #[test] + fn only_formatting_shortcuts_are_announced_for_a_while() { + let mut h = harness(); + h.state_mut().run("format.bold", json!({})).unwrap(); + h.run_steps(2); + assert_eq!(heard(&h), None, "a command run another way isn't announced"); + assert_eq!(press(&mut h, Modifiers::COMMAND, Key::Z), None, "Undo isn't announced"); + assert!(press(&mut h, Modifiers::COMMAND, Key::I).is_some()); + if let Some(a) = &mut h.state_mut().announcement { + a.at -= super::SHOWN_MS; + } + h.run_steps(2); + assert_eq!(heard(&h), None, "gone after three seconds"); + } +} diff --git a/crates/ui-egui/src/app.rs b/crates/ui-egui/src/app.rs index 6223b5714c..a2febd62fc 100644 --- a/crates/ui-egui/src/app.rs +++ b/crates/ui-egui/src/app.rs @@ -133,6 +133,7 @@ impl WordApp { zotero: zotero::ZoteroLink::default(), ctx: None, ime_origin: false, + announcement: None, read_aloud_error: None, autosave_path: None, saves_in_flight: Vec::new(), diff --git a/crates/ui-egui/src/app/frame.rs b/crates/ui-egui/src/app/frame.rs index 2ecbe402d3..e3ed23fc58 100644 --- a/crates/ui-egui/src/app/frame.rs +++ b/crates/ui-egui/src/app/frame.rs @@ -46,6 +46,7 @@ impl WordApp { /// Draw the File page, the empty-window chrome, or the normal document window. pub(super) fn paint_window(&mut self, ui: &mut egui::Ui, ctx: &egui::Context, t: theme::Tokens) { + crate::announce::expose(self, ctx); let window = self.windows.shown(); let moved = |app: &WordApp| app.windows.shown() != window; if self.ui.backstage { diff --git a/crates/ui-egui/src/keys/shortcuts.rs b/crates/ui-egui/src/keys/shortcuts.rs index dce9899d03..8452320434 100644 --- a/crates/ui-egui/src/keys/shortcuts.rs +++ b/crates/ui-egui/src/keys/shortcuts.rs @@ -132,7 +132,10 @@ pub(super) fn dispatch(app: &mut WordApp, key: Key, m: Modifiers) -> bool { if m.alt && !crate::widgets::enabled(app, spec.id) { return false; } - let _ = app.run(spec.id, json!({})); + // Screen readers hear what a formatting shortcut did, as Word says it ("Bold On"). + if app.run(spec.id, json!({})).is_ok() { + crate::announce::after_shortcut(app, spec.id); + } return true; } let Some(name) = name else { return false }; diff --git a/crates/ui-egui/src/lib.rs b/crates/ui-egui/src/lib.rs index 0e63602736..16fec1c9dd 100644 --- a/crates/ui-egui/src/lib.rs +++ b/crates/ui-egui/src/lib.rs @@ -24,6 +24,7 @@ macro_rules! tl { pub mod a11y; pub mod a11y_pane; +mod announce; pub mod async_saves; pub mod autoscroll; pub mod backstage; @@ -590,6 +591,8 @@ pub struct WordApp { /// Whether the current command was entered by an input method's own transaction. The engine /// uses it to keep IME commits from setting the application-change signal. pub(crate) ime_origin: bool, + /// What the last formatting shortcut did, for screen readers ("Bold On"), while it is fresh. + pub(crate) announcement: Option, /// Read Aloud: the start of the sentence the caret was last moved to, and the last error shown. pub(crate) read_aloud_at: Option, pub(crate) read_aloud_error: Option, diff --git a/crates/ui-egui/src/window_ui.rs b/crates/ui-egui/src/window_ui.rs index 29464e87aa..df52958519 100644 --- a/crates/ui-egui/src/window_ui.rs +++ b/crates/ui-egui/src/window_ui.rs @@ -163,6 +163,8 @@ impl WordApp { mac_titlebar: _, control_rx: _, updates_rt: _, + // An announcement lasts three seconds, from whichever window's shortcut made it. + announcement: _, // The control channel's screenshots and input go to the active window, whichever it is. shots: _, capture_epoch: _, diff --git a/docs/gaps.md b/docs/gaps.md index 32a4369fba..b52f2ba5a4 100644 --- a/docs/gaps.md +++ b/docs/gaps.md @@ -1,6 +1,6 @@ # Where WordCraft falls short of Word -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-30 · **Change:** trivial (only the PDF sent to the printer leaves out link annotations; Save these pages as PDF keeps them, #4734; no ranked gap changed); previously trivial (documents with links print: the print job leaves out link annotations, #4734; no ranked gap changed; previously trivial: aligned-copy review fixes retain the document axis through scrolling and include secondary selections (#4764)); previously trivial (connector rerouting indexes laid-out object positions once per batch (#3631); previously trivial (custom-property bookmark-link preservation, #4767); previously trivial (Relative font-size commands preserve mixed sizes in the selection (#4903); existing button steps and one-point shortcuts are unchanged; readiness estimates unchanged); previously trivial (Arabic Backspace removes one combining mark and keeps its base letter (#4757); previously trivial (note conversion reference-run membership uses one ordered walk, #4750); previously trivial (DOCX comment-ID save lookups); previously trivial (gap 19: RTF reads and writes WMF and EMF pictures, #4259); previously trivial (#4658 bounds nested Markdown reference-label work); previously trivial (HTML import keeps preformatted lines with CR or CRLF input newlines, #4810); previously trivial (Recipient labels continue across product-sized sheets instead of stopping after the first sheet (#4880)); previously trivial (View windows: several open documents and Switch Windows in the engine; previously trivial: explicit documents keep the editor when recovery discovery finishes; readable recovery controls; previously trivial: text mini toolbar available with the right-click menu, #2959; previously trivial: personal templates in File › New and Save as Word Template, #2852; previously trivial: tracked table/row/cell/section property changes record in WordCraft, narrowing gap 5; previously trivial: a document with many content controls saves in the time the controls take, #13; previously trivial: Format Page Numbers dialog carries Word's number formats and Continue from previous section / Start at, #1113; previously trivial: centred list labels after leading page breaks, #2964; previously trivial: fixed font inputs in four layout controls; previously trivial: a right, centre or decimal tab whose text doesn't fit, or a left tab past the right indent, goes to the next line with its text, #1840; previously trivial: Bullets and Numbering toggle off style-inherited lists at their effective level, including basedOn chains and numbered ListParagraph styles; other paragraphs and list definitions stay unchanged (related to #3459); previously trivial: Russian sorting keeps ё with е and recognises decomposed ё/й; previously trivial: #8: English dialects — en-GB, en-CA, en-AU… flag each other's spellings, #1281; previously trivial: #1: shape gradients and transparency, #1500; previously trivial: text typed into a content control takes the control's formatting; localized placeholder styles recognised; previously trivial: forms protection keeps its content controls: no inserting, Properties or Remove Content Control; previously trivial: clearing a no-match font query keeps the recent heading visible, #2068; previously trivial: line breaking: a slash opening a word travels whole to the next line, #2963; previously trivial: recipient list search and merged-only view, #1576; previously trivial: #2 impact restated: only ink rendering and OLE editing remain; previously trivial: #2 narrowed: native ink nested in groups and drawing canvases kept on save; previously trivial: opening a DOCX no longer copies its pictures; previously trivial: RTF export writes sections (gap 19); previously trivial: ODT export writes sections (gap 19); previously trivial: automatic Asian/Latin and Asian/number spacing laid out, #2358; previously trivial: hint-reliant CJK outlines; previously trivial: numbered headings, #1793; previously trivial: legacy outline, shadow, emboss and imprint text effects drawn, #2534; previously trivial: #8 narrowed: Indonesian proofing from the installed Hunspell dictionary, #498; previously trivial: glossary/building blocks closed; previously trivial: Split Cells and Convert Text to Table follow the Word check, #2592; previously trivial: Language dialog keeps inherited proofing language and no-proof choices (#2717); previously trivial: #29: a copied equation also goes in the MathML clipboard formats, #1297; previously trivial: #24: the Spike, Ctrl+F3 and Ctrl+Shift+F3; previously trivial: VML freeforms read and kept on save; previously trivial: consistent preferred cell widths; previously trivial: multi-paragraph field instructions no longer add blank lines; previously trivial: page-break-only list paragraphs hide their labels; previously trivial: floating-table overlap ignores empty line-break lines; previously trivial: copies keep their formatting on the clipboard as HTML, #1523; previously trivial: sample-text formulas on Enter, #1067; previously trivial: #29: copied equations as MathML, OMML open as #1297, #816; previously trivial: the Font list no longer keeps every previewed font in memory, #848; previously trivial: table column and row markers on the rulers, #700; previously trivial: table borders and the resize handle drag on the page, #217; previously trivial: formatting revisions landed, #41; previously trivial: Draw Table and Eraser landed, #303; previously minor: beta distance restated: ~15 points, ~150–230 h; previously: first version; every known shortfall from the 2026-10-10 re-measure, ranked) · **Target:** Microsoft Word (Microsoft 365) for Mac 16.113.4 +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-01 · **Change:** trivial (formatting shortcuts say what they did to screen readers); previously trivial (only the PDF sent to the printer leaves out link annotations; Save these pages as PDF keeps them, #4734; no ranked gap changed); previously trivial (documents with links print: the print job leaves out link annotations, #4734; no ranked gap changed; previously trivial: aligned-copy review fixes retain the document axis through scrolling and include secondary selections (#4764)); previously trivial (connector rerouting indexes laid-out object positions once per batch (#3631); previously trivial (custom-property bookmark-link preservation, #4767); previously trivial (Relative font-size commands preserve mixed sizes in the selection (#4903); existing button steps and one-point shortcuts are unchanged; readiness estimates unchanged); previously trivial (Arabic Backspace removes one combining mark and keeps its base letter (#4757); previously trivial (note conversion reference-run membership uses one ordered walk, #4750); previously trivial (DOCX comment-ID save lookups); previously trivial (gap 19: RTF reads and writes WMF and EMF pictures, #4259); previously trivial (#4658 bounds nested Markdown reference-label work); previously trivial (HTML import keeps preformatted lines with CR or CRLF input newlines, #4810); previously trivial (Recipient labels continue across product-sized sheets instead of stopping after the first sheet (#4880)); previously trivial (View windows: several open documents and Switch Windows in the engine; previously trivial: explicit documents keep the editor when recovery discovery finishes; readable recovery controls; previously trivial: text mini toolbar available with the right-click menu, #2959; previously trivial: personal templates in File › New and Save as Word Template, #2852; previously trivial: tracked table/row/cell/section property changes record in WordCraft, narrowing gap 5; previously trivial: a document with many content controls saves in the time the controls take, #13; previously trivial: Format Page Numbers dialog carries Word's number formats and Continue from previous section / Start at, #1113; previously trivial: centred list labels after leading page breaks, #2964; previously trivial: fixed font inputs in four layout controls; previously trivial: a right, centre or decimal tab whose text doesn't fit, or a left tab past the right indent, goes to the next line with its text, #1840; previously trivial: Bullets and Numbering toggle off style-inherited lists at their effective level, including basedOn chains and numbered ListParagraph styles; other paragraphs and list definitions stay unchanged (related to #3459); previously trivial: Russian sorting keeps ё with е and recognises decomposed ё/й; previously trivial: #8: English dialects — en-GB, en-CA, en-AU… flag each other's spellings, #1281; previously trivial: #1: shape gradients and transparency, #1500; previously trivial: text typed into a content control takes the control's formatting; localized placeholder styles recognised; previously trivial: forms protection keeps its content controls: no inserting, Properties or Remove Content Control; previously trivial: clearing a no-match font query keeps the recent heading visible, #2068; previously trivial: line breaking: a slash opening a word travels whole to the next line, #2963; previously trivial: recipient list search and merged-only view, #1576; previously trivial: #2 impact restated: only ink rendering and OLE editing remain; previously trivial: #2 narrowed: native ink nested in groups and drawing canvases kept on save; previously trivial: opening a DOCX no longer copies its pictures; previously trivial: RTF export writes sections (gap 19); previously trivial: ODT export writes sections (gap 19); previously trivial: automatic Asian/Latin and Asian/number spacing laid out, #2358; previously trivial: hint-reliant CJK outlines; previously trivial: numbered headings, #1793; previously trivial: legacy outline, shadow, emboss and imprint text effects drawn, #2534; previously trivial: #8 narrowed: Indonesian proofing from the installed Hunspell dictionary, #498; previously trivial: glossary/building blocks closed; previously trivial: Split Cells and Convert Text to Table follow the Word check, #2592; previously trivial: Language dialog keeps inherited proofing language and no-proof choices (#2717); previously trivial: #29: a copied equation also goes in the MathML clipboard formats, #1297; previously trivial: #24: the Spike, Ctrl+F3 and Ctrl+Shift+F3; previously trivial: VML freeforms read and kept on save; previously trivial: consistent preferred cell widths; previously trivial: multi-paragraph field instructions no longer add blank lines; previously trivial: page-break-only list paragraphs hide their labels; previously trivial: floating-table overlap ignores empty line-break lines; previously trivial: copies keep their formatting on the clipboard as HTML, #1523; previously trivial: sample-text formulas on Enter, #1067; previously trivial: #29: copied equations as MathML, OMML open as #1297, #816; previously trivial: the Font list no longer keeps every previewed font in memory, #848; previously trivial: table column and row markers on the rulers, #700; previously trivial: table borders and the resize handle drag on the page, #217; previously trivial: formatting revisions landed, #41; previously trivial: Draw Table and Eraser landed, #303; previously minor: beta distance restated: ~15 points, ~150–230 h; previously: first version; every known shortfall from the 2026-10-10 re-measure, ranked) · **Target:** Microsoft Word (Microsoft 365) for Mac 16.113.4 > **Highlight update:** 2026-10-25 · Highlight shortcut toggles the last chosen colour off when the whole selection has it; explicit colour commands remain setters (#4085). Readiness estimates unchanged. > **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-29 · **Change:** trivial (aligned-copy review fixes retain the document axis through scrolling and include secondary selections (#4764)); previously trivial (#15: bibliography sources keep a corporate author, #4848); previously trivial (Table Properties applies to the selected rows, columns and cells, #4857); previously trivial (Relative font-size commands preserve mixed sizes in the selection (#4903); existing button steps and one-point shortcuts are unchanged; readiness estimates unchanged); previously trivial (Arabic Backspace removes one combining mark and keeps its base letter (#4757); previously trivial (Recipient labels continue across product-sized sheets instead of stopping after the first sheet (#4880)); previously trivial (#7: Custom Document Properties dialog, #2982; previously trivial: egui 0.37 migration: the interface catalogs stay shared and pinned by `craft-i18n.rev` at `9205108cfdced5177706264038848b68b2422d2b` (27 languages, English fallback); input-method handling has new regressions but managed CI passed, and native IME acceptance plus native-speaker catalog review remain open; previously trivial: Markdown code spans keep line-broken text literal, #3738; previously trivial: small follow-ups from the field, table and AutoFormat batch, #4232; previously trivial: highlight target includes selected paragraph marks, #4085; previously trivial: full-target highlight check beyond 10,000 runs, #4085; previously trivial: Exact-spacing table contact uses the specified line height rather than paragraph-mark metrics (#3977); previously trivial: cu20we: restrict pre-spacing float origins to paragraph anchors; document cap helpers and regressions; previously trivial: a command that changes nothing is not an edit: no undo step, no unsaved changes, no relayout, and the redo stack survives it; previously minor: #8 narrowed: Spanish proofing (Spain, Mexico, Latin America, Uruguay) from the installed Hunspell dictionaries, #3360, #3553; previously trivial: gap 10: group connector rerouting preserves transformed free and unresolved endpoints under nonuniform scaling; obstacle routing still missing; readiness estimates unchanged; previously trivial: a word with no break opportunity in it no longer makes the layout quadratic, #3412; previously trivial: the ranked gap list held two rows each for #19, #20 and #21; each gap appears once now; a document with many relationships opens in the time its part takes, #3411; previously trivial: the file commands that change the document are checked on a protected document, the protection of a protected document needs an explicit stop, the session author can't change through `file.setAuthor` under protection (the CLI's `--author` uses the same protection check), and the post-check compares the settings and the metadata; previously trivial: explicit documents keep the editor when recovery discovery finishes; readable recovery controls; previously trivial: text mini toolbar available with the right-click menu, #2959; previously trivial: personal templates in File › New and Save as Word Template, #2852; previously trivial: tracked table/row/cell/section property changes record in WordCraft, narrowing gap 5; previously trivial: a document with many content controls saves in the time the controls take, #13; previously trivial: Format Page Numbers dialog carries Word's number formats and Continue from previous section / Start at, #1113; previously trivial: centred list labels after leading page breaks, #2964; previously trivial: fixed font inputs in four layout controls; previously trivial: a right, centre or decimal tab whose text doesn't fit, or a left tab past the right indent, goes to the next line with its text, #1840; previously trivial: Bullets and Numbering toggle off style-inherited lists at their effective level, including basedOn chains and numbered ListParagraph styles; other paragraphs and list definitions stay unchanged (related to #3459); previously trivial: Russian sorting keeps ё with е and recognises decomposed ё/й; previously trivial: #8: English dialects — en-GB, en-CA, en-AU… flag each other's spellings, #1281; previously trivial: #1: shape gradients and transparency, #1500; previously trivial: text typed into a content control takes the control's formatting; localized placeholder styles recognised; previously trivial: forms protection keeps its content controls: no inserting, Properties or Remove Content Control; previously trivial: clearing a no-match font query keeps the recent heading visible, #2068; previously trivial: line breaking: a slash opening a word travels whole to the next line, #2963; previously trivial: recipient list search and merged-only view, #1576; previously trivial: #2 impact restated: only ink rendering and OLE editing remain; previously trivial: #2 narrowed: native ink nested in groups and drawing canvases kept on save; previously trivial: opening a DOCX no longer copies its pictures; previously trivial: RTF export writes sections (gap 19); previously trivial: ODT export writes sections (gap 19); previously trivial: automatic Asian/Latin and Asian/number spacing laid out, #2358; previously trivial: hint-reliant CJK outlines; previously trivial: numbered headings, #1793; previously trivial: legacy outline, shadow, emboss and imprint text effects drawn, #2534; previously trivial: #8 narrowed: Indonesian proofing from the installed Hunspell dictionary, #498; previously trivial: glossary/building blocks closed; previously trivial: Split Cells and Convert Text to Table follow the Word check, #2592; previously trivial: Language dialog keeps inherited proofing language and no-proof choices (#2717); previously trivial: #29: a copied equation also goes in the MathML clipboard formats, #1297; previously trivial: #24: the Spike, Ctrl+F3 and Ctrl+Shift+F3; previously trivial: VML freeforms read and kept on save; previously trivial: consistent preferred cell widths; previously trivial: multi-paragraph field instructions no longer add blank lines; previously trivial: page-break-only list paragraphs hide their labels; previously trivial: floating-table overlap ignores empty line-break lines; previously trivial: copies keep their formatting on the clipboard as HTML, #1523; previously trivial: sample-text formulas on Enter, #1067; previously trivial: #29: copied equations as MathML, OMML open as #1297, #816; previously trivial: the Font list no longer keeps every previewed font in memory, #848; previously trivial: table column and row markers on the rulers, #700; previously trivial: table borders and the resize handle drag on the page, #217; previously trivial: formatting revisions landed, #41; previously trivial: Draw Table and Eraser landed, #303; previously minor: beta distance restated: ~15 points, ~150–230 h; previously: first version; every known shortfall from the 2026-10-10 re-measure, ranked) · **Target:** Microsoft Word (Microsoft 365) for Mac 16.113.4 @@ -152,6 +152,7 @@ Recipient label generation (#4880) now includes all selected recipients across a | Date | Change | Summary | |---|---|---| +| 2026-11-01 | trivial | formatting shortcuts say what they did to screen readers | | 2026-10-30 | trivial | Only the PDF sent to the printer omits link annotations; File › Print › Save these pages as PDF (`file.printPdf`) keeps them, like Export (#4734); no ranked gap changed; readiness estimates unchanged | | 2026-10-29 | trivial | The print job's PDF omits link annotations, which the spooler refused to fit to the paper, so documents with links reach the printer (#4734); physical printer output remains to be validated; no ranked gap changed; readiness estimates unchanged | | 2026-10-28 | trivial | Aligned copies retain their locked document coordinate during middle-button scrolling and can start on secondary selected objects; existing Ctrl and Shift selection behavior stays (#4764) | diff --git a/docs/ui-parity.md b/docs/ui-parity.md index 18ea32347e..ff0efcf1f7 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -1,6 +1,6 @@ # UI parity with Microsoft Word -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-31 · **Change:** trivial (Alt, F badges the Backstage pages; Alt, F, P and V open Print, #4960); previously trivial (View › Macros opens a Macros dialog with Run, Delete and Record, #4327); previously trivial (aligned-copy review fixes retain the document axis through scrolling and include secondary selections (#4764)); previously trivial (Table Properties: row, column and cell settings apply to the selected rows, columns and cells; mixed row check boxes, #4857); previously trivial (Insert › Shapes shows the basic shapes as a grid of drawn icon tiles, #4349); previously trivial (File › Options › Proofing › AutoCorrect Options opens with no document open, #4585); previously trivial (the Shading buttons show the last picked colour, #4412); previously trivial (a blank User Name in File › Options stays blank after a restart, #4368); previously trivial (window size falls back to the screen rectangle when the reported inner size is invalid; equation symbol tooltips no longer repeat a missing glyph's name); previously trivial (window titles and suggested file names omit NUL characters, #3634); previously trivial (Recipient labels continue across product-sized sheets instead of stopping after the first sheet (#4880)); previously trivial (Custom Document Properties dialog from File › Info › Properties › Advanced Properties…, #2982; previously trivial: View › Window › New Window opens another window on the document, each with its own caret and view; previously trivial: mail merge: First Record, Last Record and a record number box in Preview Results; Finish & Merge asks which records to merge or print, #3028; previously trivial: selection bar for right-to-left paragraphs and table rows; previously trivial: read only and comments-only protection grey out edits; previously trivial: the Font dialog previews "NaN" or "inf" in the Size box at 12 pt, #3663; previously trivial: File › Options disables the User name field while Restrict Editing is active; previously trivial: while editing a header or footer, a click in the other one edits it there without scrolling; previously trivial: explicit documents keep the editor when recovery discovery finishes; readable recovery controls; previously trivial: Insert Table of Figures dialog: any caption label, #3013; previously trivial: Home › Underline drop-down shows its lines, #2738; previously trivial: the text context menu includes the formatting mini toolbar, #2959; previously trivial: personal templates in File › New and Save as Word Template, #2852; previously trivial: the scrollbar page tip stays on one line as the page number grows, #3341; previously trivial: File › Home and New: templates and recent documents are buttons named for screen readers, #3176; previously trivial: forms protection greys out the Developer tab's control buttons and Properties; previously trivial: AltGr doesn't open KeyTips, #2388; previously trivial: closing the header or footer puts the caret back where it was in the body, #3331; previously trivial: Format Page Numbers dialog: number format and Continue from previous section / Start at, #1113; previously trivial: inline pictures drag to a dashed insertion cursor and stay inline, #2233, #2234; previously trivial: Save Changes prompt: a text file saved over itself closes, #2376; previously trivial: the equation being edited is framed as in Word: an outline as tall as its line, a grip, an options strip that opens its menu, and its current argument shaded; previously trivial: the table handles show while the caret is in the table, #2428; previously trivial: legacy menu keys, #1697; previously trivial: Shape Fill › Gradient and the Format Shape pane, #1500; previously trivial: Focus fills the screen, and Full Screen View shows the pages alone, #1678; previously trivial: the text pointer over the page is drawn black or white on Windows, #1746; previously trivial: a click in the header/footer band from the body no longer scrolls to the body text, #2103; previously trivial: File › Recover follows the app theme, #3243; previously trivial: long navigation headings wrap onto further lines within the pane, #3015; previously trivial: clearing a no-match font query keeps the recent heading visible, #2068; previously trivial: dragging the vertical scrollbar names the page at the top of the window, #2551; previously trivial: Add Font imports every selected font file, #1789); previously trivial (File › Close keeps the window, #1712; previously trivial: the Spike: Ctrl+F3 and Ctrl+Shift+F3; previously trivial: Ctrl+wheel zoom no longer scrolls the document, #1743; previously trivial: a mouse drag on a table leaves the view where it is, #1738; previously trivial: numbered headings, #1793; previously trivial: Navigation Find exposes Results, #2096; previously trivial: the tab strip never draws tabs over Comments / Editing / Share, #2026; previously trivial: Columns on selected text, #2024; previously trivial: Different First Page headers reachable from page 1, #2826; previously trivial: a copied equation also goes in the clipboard's MathML formats, #1297; previously trivial: Read Mode keeps the keyboard, shows whole columns and keeps text clear of the page-turn bar, #1772); previously trivial: font list entries of tall-ascent fonts sit in their row, not cut off, #2570); previously trivial: Split Cells and Convert Text to Table dialogs follow Word's merged-cell limits and Initial column width, #2592; previously trivial: a new source's Tag is made like Word's, three letters of the author and two digits of the year with a number added when taken, and an edit keeps the Tag, #2094; previously trivial: Web Layout text fills the window width, #1876; previously trivial: Language dialog keeps inherited proofing language and no-proof choices (#2717)); previously trivial: comment balloons readable in the dark theme, #2045; previously trivial: Recently Used Fonts section at the top of the font list, #2068; previously trivial: web preferences kept between visits, #2132; previously trivial: dialog close control: a Windows-style box at the title bar's right end, the whole box clickable, red on hover, #1885); previously trivial (Modify Table Style formats every table style part, #714); previously trivial: a click on the ribbon chrome hands the keyboard to the page in the same frame, #1093 follow-up; previously trivial: Page Setup vertical alignment, #1320; previously trivial: the app opens on the Home tab every launch, as in Word; previously trivial: no document behind the Start screen, #1129; previously trivial: equation pictures share a few textures, #1002; previously trivial: selection bar in the left margin, #856; previously trivial: table column and row markers on the rulers, #700; previously trivial: table borders and the resize handle drag on the page, #217; previously major: first version; ribbon, dialogs, shortcuts and on-canvas interaction measured from `crates/ui-egui` and the command registry) · **Target:** Microsoft Word (Microsoft 365) for Mac 16.113.4 +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-01 · **Change:** trivial (formatting shortcuts say what they did to screen readers); previously trivial (Alt, F badges the Backstage pages; Alt, F, P and V open Print, #4960); previously trivial (View › Macros opens a Macros dialog with Run, Delete and Record, #4327); previously trivial (aligned-copy review fixes retain the document axis through scrolling and include secondary selections (#4764)); previously trivial (Table Properties: row, column and cell settings apply to the selected rows, columns and cells; mixed row check boxes, #4857); previously trivial (Insert › Shapes shows the basic shapes as a grid of drawn icon tiles, #4349); previously trivial (File › Options › Proofing › AutoCorrect Options opens with no document open, #4585); previously trivial (the Shading buttons show the last picked colour, #4412); previously trivial (a blank User Name in File › Options stays blank after a restart, #4368); previously trivial (window size falls back to the screen rectangle when the reported inner size is invalid; equation symbol tooltips no longer repeat a missing glyph's name); previously trivial (window titles and suggested file names omit NUL characters, #3634); previously trivial (Recipient labels continue across product-sized sheets instead of stopping after the first sheet (#4880)); previously trivial (Custom Document Properties dialog from File › Info › Properties › Advanced Properties…, #2982; previously trivial: View › Window › New Window opens another window on the document, each with its own caret and view; previously trivial: mail merge: First Record, Last Record and a record number box in Preview Results; Finish & Merge asks which records to merge or print, #3028; previously trivial: selection bar for right-to-left paragraphs and table rows; previously trivial: read only and comments-only protection grey out edits; previously trivial: the Font dialog previews "NaN" or "inf" in the Size box at 12 pt, #3663; previously trivial: File › Options disables the User name field while Restrict Editing is active; previously trivial: while editing a header or footer, a click in the other one edits it there without scrolling; previously trivial: explicit documents keep the editor when recovery discovery finishes; readable recovery controls; previously trivial: Insert Table of Figures dialog: any caption label, #3013; previously trivial: Home › Underline drop-down shows its lines, #2738; previously trivial: the text context menu includes the formatting mini toolbar, #2959; previously trivial: personal templates in File › New and Save as Word Template, #2852; previously trivial: the scrollbar page tip stays on one line as the page number grows, #3341; previously trivial: File › Home and New: templates and recent documents are buttons named for screen readers, #3176; previously trivial: forms protection greys out the Developer tab's control buttons and Properties; previously trivial: AltGr doesn't open KeyTips, #2388; previously trivial: closing the header or footer puts the caret back where it was in the body, #3331; previously trivial: Format Page Numbers dialog: number format and Continue from previous section / Start at, #1113; previously trivial: inline pictures drag to a dashed insertion cursor and stay inline, #2233, #2234; previously trivial: Save Changes prompt: a text file saved over itself closes, #2376; previously trivial: the equation being edited is framed as in Word: an outline as tall as its line, a grip, an options strip that opens its menu, and its current argument shaded; previously trivial: the table handles show while the caret is in the table, #2428; previously trivial: legacy menu keys, #1697; previously trivial: Shape Fill › Gradient and the Format Shape pane, #1500; previously trivial: Focus fills the screen, and Full Screen View shows the pages alone, #1678; previously trivial: the text pointer over the page is drawn black or white on Windows, #1746; previously trivial: a click in the header/footer band from the body no longer scrolls to the body text, #2103; previously trivial: File › Recover follows the app theme, #3243; previously trivial: long navigation headings wrap onto further lines within the pane, #3015; previously trivial: clearing a no-match font query keeps the recent heading visible, #2068; previously trivial: dragging the vertical scrollbar names the page at the top of the window, #2551; previously trivial: Add Font imports every selected font file, #1789); previously trivial (File › Close keeps the window, #1712; previously trivial: the Spike: Ctrl+F3 and Ctrl+Shift+F3; previously trivial: Ctrl+wheel zoom no longer scrolls the document, #1743; previously trivial: a mouse drag on a table leaves the view where it is, #1738; previously trivial: numbered headings, #1793; previously trivial: Navigation Find exposes Results, #2096; previously trivial: the tab strip never draws tabs over Comments / Editing / Share, #2026; previously trivial: Columns on selected text, #2024; previously trivial: Different First Page headers reachable from page 1, #2826; previously trivial: a copied equation also goes in the clipboard's MathML formats, #1297; previously trivial: Read Mode keeps the keyboard, shows whole columns and keeps text clear of the page-turn bar, #1772); previously trivial: font list entries of tall-ascent fonts sit in their row, not cut off, #2570); previously trivial: Split Cells and Convert Text to Table dialogs follow Word's merged-cell limits and Initial column width, #2592; previously trivial: a new source's Tag is made like Word's, three letters of the author and two digits of the year with a number added when taken, and an edit keeps the Tag, #2094; previously trivial: Web Layout text fills the window width, #1876; previously trivial: Language dialog keeps inherited proofing language and no-proof choices (#2717)); previously trivial: comment balloons readable in the dark theme, #2045; previously trivial: Recently Used Fonts section at the top of the font list, #2068; previously trivial: web preferences kept between visits, #2132; previously trivial: dialog close control: a Windows-style box at the title bar's right end, the whole box clickable, red on hover, #1885); previously trivial (Modify Table Style formats every table style part, #714); previously trivial: a click on the ribbon chrome hands the keyboard to the page in the same frame, #1093 follow-up; previously trivial: Page Setup vertical alignment, #1320; previously trivial: the app opens on the Home tab every launch, as in Word; previously trivial: no document behind the Start screen, #1129; previously trivial: equation pictures share a few textures, #1002; previously trivial: selection bar in the left margin, #856; previously trivial: table column and row markers on the rulers, #700; previously trivial: table borders and the resize handle drag on the page, #217; previously major: first version; ribbon, dialogs, shortcuts and on-canvas interaction measured from `crates/ui-egui` and the command registry) · **Target:** Microsoft Word (Microsoft 365) for Mac 16.113.4 Recovery discovery no longer interrupts an explicitly created or opened document. Older copies remain in File › Recover, whose buttons use the interface palette. See [local recovery](recovery.md). @@ -59,7 +59,7 @@ Document title opens Rename Document; the account badge opens Options › Genera | Focus and Full Screen (#1678, #980) | View › Focus fills the screen with the document on black, with a slim bar whose "⋯" drops the ribbon over the page; Full Screen View (`view.fullScreenView`, any key in Customize Keyboard) shows the pages alone with Search at the top; the two turn each other off. View › Window › Full Screen (`view.fullScreen`, F11, ⌃⌘F on macOS) fills the screen with the whole window, ribbon and all. Esc leaves Focus or Full Screen View, then Full Screen, once nothing nearer takes it; leaving gives back the earlier window size; the window manager's or macOS's own full screen keeps them in step. Ctrl+F1 (⌘⌥R on macOS) collapses or expands the ribbon; a shortcut of your own on Ctrl+F1 wins. Web: Full Screen off (the browser's own F11); Focus and Full Screen View hide the chrome only | Focus, Toggle Full Screen View (Alt, V, U, #1697), Word for Mac's View › Enter Full Screen, ⌘⌥R to collapse or expand the ribbon (Ctrl+F1 on Windows) | 85% | 0.5 | | File dialogs (Open, Save As, Export, Insert Picture) | system dialog, without blocking the window (#94), its Save As type list naming every format with the document's own first (#1399); Linux/BSD without a file chooser portal or zenity: WordCraft's own browser, also File › Open › Browse in WordCraft… (#576) | system dialog | 95% | — | | Platform conventions (macOS menus/traffic lights #255, Windows title bar, Linux CSD on Wayland #78) | partial | native | 70% | 3–5 | -| Screen readers (VoiceOver, Narrator, Orca) | AccessKit on; the document canvas describes paragraphs, headings (level), list items, tables, links, pictures (alt text) and the caret and selection, for the pages on screen (#488); the ribbon's font name and size boxes, and the dropdown arrows beside them, say what they are (#3172); Windows Magnifier follows the caret, also onto an empty line after Enter or Shift+Enter (#1119); File › Home and New's templates and recent documents are buttons named by their caption or file name, with the path when two file names are the same (#3176); not yet tried with real screen readers | full | 50% | 5–8 | +| Screen readers (VoiceOver, Narrator, Orca) | AccessKit on; the document canvas describes paragraphs, headings (level), list items, tables, links, pictures (alt text) and the caret and selection, for the pages on screen (#488); the ribbon's font name and size boxes, and the dropdown arrows beside them, say what they are (#3172); Windows Magnifier follows the caret, also onto an empty line after Enter or Shift+Enter (#1119); the formatting shortcuts say what they did, as Word does (Bold On, Center Off, Font 14 pt), through a polite live region; File › Home and New's templates and recent documents are buttons named by their caption or file name, with the path when two file names are the same (#3176); not yet tried with real screen readers | full | 50% | 5–8 | | Right-to-left (mirrored) interface | ❌ | ✅ (Arabic, Hebrew Word) | 0% | in localization | > **Header/footer preset update:** 2026-10-15 · Three columns creates a one-row, three-cell borderless table (#2197). The active header/footer story has screen-only cell guides while editing, even with View Gridlines off. Closing the story removes automatic guides; explicit View Gridlines still outlines every table. No document border is changed by showing these guides. Readiness estimates unchanged. @@ -86,6 +86,7 @@ Labels → New Document with “One label per recipient” includes all filtered | Date | Change | Summary | |---|---|---| +| 2026-11-01 | trivial | Screen readers: the formatting shortcuts say what they did, as Word does: Bold, Italic, Underline, Subscript and Superscript On or Off, the alignment shortcuts' command On or Off (Center twice: Center On, then Center Off), and the font size after Grow and Shrink Font (Font 14 pt). A polite live region, a new one each time so the same words twice are heard twice, for three seconds; ribbon clicks aren't announced, as their buttons say their state | | 2026-10-31 | trivial | Keytips: Alt, F badges the Backstage pages with Word's letters and the letter opens the page; Alt, F, P and Alt, F, V open Print; the badges end with the Backstage (#4960) | | 2026-10-31 | trivial | View › Macros opens a Macros dialog (also Alt+F8 and command search): the macros of this session listed with Run, Delete and Record, which reads Stop Recording while a recording runs; the button did nothing before, as `tools.macros` without a macro to run, define or delete only returned the list (#4327) | | 2026-10-28 | trivial | Aligned copies retain their locked document coordinate during middle-button scrolling and can start on secondary selected objects; existing Ctrl and Shift selection behavior stays (#4764) | From 6b5f1587698616d57560ee46fb4fe9dc78731035 Mon Sep 17 00:00:00 2001 From: squalorso <316661546+squalorso@users.noreply.github.com> Date: Sun, 1 Nov 2026 01:41:26 +0100 Subject: [PATCH 2/7] Screen readers: an alignment shortcut says what the paragraph it formatted now is A selection ending at the next paragraph's start (Shift+Down from a paragraph's start) formats only the paragraph it covers (#418), but the announcement read the alignment at the focus, in the paragraph left out: Ctrl+E said "Center Off" after centring. It now reads a paragraph the command formatted, as the command chooses it. A test also pins that the announcement is in the tree on the frame after the key, which egui asks for itself. Co-Authored-By: Claude Opus 5.5 --- crates/ui-egui/src/announce.rs | 45 +++++++++++++++++++++++++++++----- 1 file changed, 39 insertions(+), 6 deletions(-) diff --git a/crates/ui-egui/src/announce.rs b/crates/ui-egui/src/announce.rs index e09e29dd35..408d4c0b69 100644 --- a/crates/ui-egui/src/announce.rs +++ b/crates/ui-egui/src/announce.rs @@ -53,9 +53,14 @@ fn describe(app: &WordApp, id: &str) -> Option { _ => None, }; if let Some((want, name)) = alignment { - // As the ribbon's buttons show it: Center twice centres, then goes back to the left. + // As the ribbon's buttons show it: Center twice centres, then goes back to the left. Read + // in a paragraph the command formatted: a selection ending at the next paragraph's start + // leaves that one out (#418). let s = &app.session; - let align = s.doc.para_at(&s.sel.focus).map(|p| s.doc.styles.resolve_para(&p.props)).map(|r| r.align.visual(r.bidi)); + let formatted = wordcraft_engine::cmd::selected_paths(s); + let path = if formatted.contains(&s.sel.focus.path) { Some(s.sel.focus.path.clone()) } else { formatted.last().cloned() }; + let at = path.map(|path| wordcraft_doc::Pos { path, off: 0, ..s.sel.focus.clone() }); + let align = at.and_then(|at| s.doc.para_at(&at)).map(|p| s.doc.styles.resolve_para(&p.props)).map(|r| r.align.visual(r.bidi)); return Some(on_off(name, align == Some(want))); } if matches!(id, "format.growFont" | "format.shrinkFont" | "format.growFont1" | "format.shrinkFont1") { @@ -93,8 +98,8 @@ mod tests { use crate::WordApp; - fn harness() -> egui_kittest::Harness<'static, WordApp> { - let mut app = WordApp::new(wordcraft_engine::Session::new(wordcraft_doc::Document::from_text("Lanterns glow")), crate::Services::default()); + fn harness(text: &str) -> egui_kittest::Harness<'static, WordApp> { + let mut app = WordApp::new(wordcraft_engine::Session::new(wordcraft_doc::Document::from_text(text)), crate::Services::default()); app.canvas.want_focus = true; let mut h = egui_kittest::Harness::builder().with_size(egui::vec2(1440.0, 900.0)).build_ui_state( |ui, app: &mut WordApp| { @@ -130,7 +135,7 @@ mod tests { /// then "Bold Off"), each time in a new live region, so the same words twice are heard twice. #[test] fn formatting_shortcuts_say_what_they_did() { - let mut h = harness(); + let mut h = harness("Lanterns glow"); assert_eq!(heard(&h), None, "nothing to say before a shortcut"); let (text, first) = press(&mut h, Modifiers::COMMAND, Key::B).expect("Ctrl+B is announced"); assert_eq!(text, "Bold On"); @@ -160,7 +165,7 @@ mod tests { /// formatting says nothing. An announcement leaves the tree after three seconds. #[test] fn only_formatting_shortcuts_are_announced_for_a_while() { - let mut h = harness(); + let mut h = harness("Lanterns glow"); h.state_mut().run("format.bold", json!({})).unwrap(); h.run_steps(2); assert_eq!(heard(&h), None, "a command run another way isn't announced"); @@ -172,4 +177,32 @@ mod tests { h.run_steps(2); assert_eq!(heard(&h), None, "gone after three seconds"); } + + /// A selection ending at the next paragraph's start (Shift+Down from a paragraph's start) + /// formats only the paragraph it covers, as in Word: that is the one the announcement says. + #[test] + fn alignment_is_said_for_the_paragraph_the_shortcut_formatted() { + let mut h = harness("Lanterns glow\nRivers run"); + h.state_mut().session.sel = wordcraft_engine::Selection { anchor: wordcraft_doc::Pos::body(0, 0), focus: wordcraft_doc::Pos::body(1, 0) }; + h.run_steps(2); + assert_eq!(press(&mut h, Modifiers::COMMAND, Key::E).map(|(t, _)| t).as_deref(), Some("Center On")); + let align = + |h: &egui_kittest::Harness<'_, WordApp>, i| h.state().session.doc.para_at(&wordcraft_doc::Pos::body(i, 0)).and_then(|p| p.props.align); + assert_eq!((align(&h, 0), align(&h, 1)), (Some(wordcraft_doc::Align::Center), None), "only the first paragraph is centred"); + assert_eq!(press(&mut h, Modifiers::COMMAND, Key::E).map(|(t, _)| t).as_deref(), Some("Center Off")); + } + + /// The shortcut runs after the announcement's place in the frame, so the announcement goes in + /// the next frame's tree: a key asks egui for that frame itself. + #[test] + fn the_announcement_is_in_the_frame_after_the_key() { + let mut h = harness("Lanterns glow"); + // The key down alone, in one frame (`key_press_modifiers` gives each event a frame). + h.input_mut().events.push(egui::Event::Key { key: Key::B, physical_key: None, pressed: true, repeat: false, modifiers: Modifiers::COMMAND }); + h.step(); + assert_eq!(heard(&h), None, "the key's own frame built its tree before the shortcut ran"); + assert!(h.ctx.has_requested_repaint(), "the key asked for another frame"); + h.step(); + assert_eq!(heard(&h).map(|(t, _)| t).as_deref(), Some("Bold On")); + } } From cb149e62a214a2ad19526cfd77ac840a06ba1c39 Mon Sep 17 00:00:00 2001 From: squalorso <316661546+squalorso@users.noreply.github.com> Date: Mon, 2 Nov 2026 20:33:36 +0100 Subject: [PATCH 3/7] Tests: every formatting shortcut's words, and a burst of presses Each shortcut says its own words, read from the formatting after it ran. Ten presses, one per frame or all in one, leave one announcement, the latest, in one live region, and the words go through the interface catalogs. Co-Authored-By: Claude Opus 5.5 --- crates/ui-egui/src/announce.rs | 125 +++++++++++++++++++++++++++++++++ 1 file changed, 125 insertions(+) diff --git a/crates/ui-egui/src/announce.rs b/crates/ui-egui/src/announce.rs index 408d4c0b69..2397f2d546 100644 --- a/crates/ui-egui/src/announce.rs +++ b/crates/ui-egui/src/announce.rs @@ -205,4 +205,129 @@ mod tests { h.step(); assert_eq!(heard(&h).map(|(t, _)| t).as_deref(), Some("Bold On")); } + + /// Each formatting shortcut says its own words, read from the formatting after it ran: the + /// format's name and On or Off for Ctrl+B, I, U, = (Subscript) and Shift+= (Superscript), the + /// alignment's name for Ctrl+E, R, J and L, and the size the selection now has for + /// Ctrl+Shift+. and , (Grow and Shrink Font) and Ctrl+] and [ (by 1 pt). A selection of mixed + /// sizes has no one size to say, so nothing is said. + #[test] + fn every_formatting_shortcut_says_its_own_words() { + let mut h = harness("Lanterns glow"); + h.state_mut().run("format.size", json!({"size": 12})).unwrap(); + h.run_steps(2); + let (cmd, shift) = (Modifiers::COMMAND, Modifiers::COMMAND | Modifiers::SHIFT); + for (m, key, said) in [ + (cmd, Key::B, "Bold On"), + (cmd, Key::B, "Bold Off"), + (cmd, Key::I, "Italic On"), + (cmd, Key::I, "Italic Off"), + (cmd, Key::U, "Underline On"), + (cmd, Key::U, "Underline Off"), + (cmd, Key::Equals, "Subscript On"), + (cmd, Key::Equals, "Subscript Off"), + (shift, Key::Equals, "Superscript On"), + (shift, Key::Equals, "Superscript Off"), + (cmd, Key::E, "Center On"), + (cmd, Key::R, "Align Right On"), + (cmd, Key::J, "Justify On"), + (cmd, Key::L, "Align Left On"), + (shift, Key::Period, "Font 14 pt"), + (shift, Key::Comma, "Font 12 pt"), + (cmd, Key::CloseBracket, "Font 13 pt"), + (cmd, Key::OpenBracket, "Font 12 pt"), + ] { + assert_eq!(press(&mut h, m, key).map(|(t, _)| t).as_deref(), Some(said), "{m:?} {key:?}"); + } + + let mut h = harness("Lanterns glow"); + let sizes = [(0, 8, 12.0), (8, 13, 16.0)]; + for (from, to, size) in sizes { + h.state_mut().session.sel = + wordcraft_engine::Selection { anchor: wordcraft_doc::Pos::body(0, from), focus: wordcraft_doc::Pos::body(0, to) }; + h.state_mut().run("format.size", json!({"size": size})).unwrap(); + } + h.state_mut().session.sel = wordcraft_engine::Selection { anchor: wordcraft_doc::Pos::body(0, 0), focus: wordcraft_doc::Pos::body(0, 13) }; + h.run_steps(2); + assert_eq!(press(&mut h, shift, Key::Period), None, "mixed sizes: nothing to say"); + assert!(h.state().announcement.is_none(), "and nothing waits to be said"); + } + + /// The words are looked up in the interface catalogs, so each language says its own. + #[test] + fn the_words_go_through_the_interface_catalogs() { + let mut h = harness("Lanterns glow"); + crate::i18n::pseudo::set(true); + let said = press(&mut h, Modifiers::COMMAND, Key::B).map(|(t, _)| t).unwrap_or_default(); + crate::i18n::pseudo::set(false); + assert!(said.contains('⟦') && crate::i18n::pseudo::unmarked(&said).trim().is_empty(), "every word is marked: {said:?}"); + } + + /// Ten presses in a burst, one per frame or all in one frame (a held key, or keys typed + /// faster than frames), leave one announcement at a time, the latest, in one live region: + /// each replaces the last (`WordApp::announcement` holds one), so nothing queues up. + #[test] + fn a_burst_of_ten_presses_leaves_one_announcement_the_latest() { + let live = |h: &egui_kittest::Harness<'_, WordApp>| h.query_all_by(|n| n.live() == Live::Polite).count(); + let mut h = harness("Lanterns glow"); + let mut nodes = std::collections::HashSet::new(); + for i in 0..10 { + let (text, node) = press(&mut h, Modifiers::COMMAND, Key::B).expect("each press is announced"); + assert_eq!(text, if i % 2 == 0 { "Bold On" } else { "Bold Off" }, "press {i}"); + assert_eq!(live(&h), 1, "press {i}: one live region in the tree"); + nodes.insert(node); + } + assert_eq!(nodes.len(), 10, "each press a new node, so each is heard"); + + let mut h = harness("Lanterns glow"); + let key = |pressed| egui::Event::Key { key: Key::B, physical_key: None, pressed, repeat: false, modifiers: Modifiers::COMMAND }; + for _ in 0..10 { + h.input_mut().events.extend([key(true), key(false)]); + } + h.run_steps(2); + let bold = wordcraft_engine::cmd::format::state(&h.state().session).get("bold").and_then(serde_json::Value::as_bool); + assert_eq!(bold, Some(false), "ten Ctrl+B in one frame: bold on and off five times"); + assert_eq!(live(&h), 1, "one live region in the tree"); + assert_eq!(heard(&h).map(|(t, _)| t).as_deref(), Some("Bold Off"), "the latest is said"); + } + + /// The words go through the interface's catalogs (`tl!`), as the ribbon's labels do: a + /// translated interface says them in its language. Checked with a fixture language and, when + /// the craft-i18n catalogs are embedded (`CRAFT_I18N_DIR`), Turkish and Simplified Chinese. + #[test] + fn the_announcements_are_in_the_interface_language() { + let said = |app: &mut WordApp, id: &str| { + app.run(id, json!({})).unwrap(); + super::describe(app, id) + }; + let app = || { + let mut app = + WordApp::new(wordcraft_engine::Session::new(wordcraft_doc::Document::from_text("Lanterns glow")), crate::Services::default()); + app.session.sel = wordcraft_engine::Selection { anchor: wordcraft_doc::Pos::body(0, 0), focus: wordcraft_doc::Pos::body(0, 8) }; + app.run("format.size", json!({"size": 12})).unwrap(); + app + }; + let mut a = app(); + crate::i18n::set_current(crate::i18n::fixture_lang( + "x-fixture", + "\tBold\tBold-FX\n\tOn\tOn-FX\n\tOff\tOff-FX\n\tCenter\tCenter-FX\n\tFont\tFont-FX\n\tpt\tpt-FX\n", + )); + assert_eq!(said(&mut a, "format.bold").as_deref(), Some("Bold-FX On-FX")); + assert_eq!(said(&mut a, "format.bold").as_deref(), Some("Bold-FX Off-FX")); + assert_eq!(said(&mut a, "para.alignCenter").as_deref(), Some("Center-FX On-FX")); + assert_eq!(said(&mut a, "format.growFont").as_deref(), Some("Font-FX 14 pt-FX")); + // The catalogs' own words: craft-i18n's `common.tsv` and `wordcraft.tsv` rows. + if crate::i18n::catalogs_embedded() { + for (code, bold, center, font) in + [("tr", "Kalın Açık", "Ortala Açık", "Yazı Tipi 14 pt"), ("zh-hans", "加粗 开", "居中 开", "字体 14 磅")] + { + let mut a = app(); + crate::i18n::set_current(crate::i18n::Lang::from_code(code).expect("an interface language")); + assert_eq!(said(&mut a, "format.bold").as_deref(), Some(bold), "{code}"); + assert_eq!(said(&mut a, "para.alignCenter").as_deref(), Some(center), "{code}"); + assert_eq!(said(&mut a, "format.growFont").as_deref(), Some(font), "{code}"); + } + } + crate::i18n::set_current(crate::i18n::Lang::EN); + } } From d22840c369770deb5b2a4dab62e1a4893189744b Mon Sep 17 00:00:00 2001 From: squalorso <316661546+squalorso@users.noreply.github.com> Date: Wed, 18 Nov 2026 14:51:11 +0100 Subject: [PATCH 4/7] Announcements: each window keeps its own An announcement was app-wide, so for three seconds every window drawn put it in its own tree, though it describes formatting in the window whose shortcut made it. It is now per-window state, swapped with the window's status message and the rest, and a test checks that another window has nothing to say. --- crates/ui-egui/src/announce.rs | 13 +++++++++++++ crates/ui-egui/src/app.rs | 3 ++- crates/ui-egui/src/window_ui.rs | 8 ++++++-- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/crates/ui-egui/src/announce.rs b/crates/ui-egui/src/announce.rs index 2397f2d546..a4cb170a13 100644 --- a/crates/ui-egui/src/announce.rs +++ b/crates/ui-egui/src/announce.rs @@ -98,6 +98,19 @@ mod tests { use crate::WordApp; + /// An announcement belongs to the window whose shortcut made it, as its status message does: + /// another window drawn within its three seconds doesn't put it in its own tree. + #[test] + fn an_announcement_stays_with_its_window() { + let mut app = WordApp::new(wordcraft_engine::Session::new(wordcraft_doc::Document::new()), crate::Services::default()); + app.announcement = Some(super::Announcement { text: "Bold On".into(), serial: 0, at: crate::now_ms() }); + let mut other = crate::window_ui::WindowUi::new(app.session.document_id()); + app.swap_window(&mut other); + assert!(app.announcement.is_none(), "the other window has nothing to say"); + app.swap_window(&mut other); + assert_eq!(app.announcement.as_ref().map(|a| a.text.as_str()), Some("Bold On"), "it is back with its window"); + } + fn harness(text: &str) -> egui_kittest::Harness<'static, WordApp> { let mut app = WordApp::new(wordcraft_engine::Session::new(wordcraft_doc::Document::from_text(text)), crate::Services::default()); app.canvas.want_focus = true; diff --git a/crates/ui-egui/src/app.rs b/crates/ui-egui/src/app.rs index 727efb89bf..dbe21e3080 100644 --- a/crates/ui-egui/src/app.rs +++ b/crates/ui-egui/src/app.rs @@ -43,6 +43,7 @@ impl WordApp { restrict, spelling_review, status_msg, + announcement, previews, change_picture_target, recipient_list_pending, @@ -151,7 +152,6 @@ impl WordApp { zotero: zotero::ZoteroLink::default(), ctx: None, ime_origin: false, - announcement: None, read_aloud_error: None, autosave_path: None, saves_in_flight: Vec::new(), @@ -169,6 +169,7 @@ impl WordApp { restrict, spelling_review, status_msg, + announcement, previews, change_picture_target, recipient_list_pending, diff --git a/crates/ui-egui/src/window_ui.rs b/crates/ui-egui/src/window_ui.rs index 68e797a544..ab54b28bbe 100644 --- a/crates/ui-egui/src/window_ui.rs +++ b/crates/ui-egui/src/window_ui.rs @@ -24,6 +24,9 @@ pub(crate) struct WindowUi { pub(crate) restrict: dialogs_review::RestrictPane, pub(crate) spelling_review: Option, pub(crate) status_msg: Option<(String, f64)>, + /// What this window's last formatting shortcut did, for screen readers: only this window's tree + /// shows it. + pub(crate) announcement: Option, pub(crate) previews: previews::Previews, pub(crate) change_picture_target: Option, pub(crate) recipient_list_pending: bool, @@ -100,6 +103,7 @@ impl WindowUi { restrict: Default::default(), spelling_review: None, status_msg: None, + announcement: None, previews: Default::default(), change_picture_target: None, recipient_list_pending: false, @@ -175,8 +179,6 @@ impl WordApp { mac_titlebar: _, control_rx: _, updates_rt: _, - // An announcement lasts three seconds, from whichever window's shortcut made it. - announcement: _, font_notice_seen: _, font_notices: _, packs_rt: _, @@ -238,6 +240,7 @@ impl WordApp { restrict, spelling_review, status_msg, + announcement, previews, change_picture_target, recipient_list_pending, @@ -347,6 +350,7 @@ impl WordApp { restrict, spelling_review, status_msg, + announcement, previews, change_picture_target, recipient_list_pending, From 578f3576e954c05cb402d56eb43b5e0a29e86a22 Mon Sep 17 00:00:00 2001 From: FredApps Date: Fri, 20 Nov 2026 15:15:21 +0100 Subject: [PATCH 5/7] Format the font-size announcement using the active number region --- crates/ui-egui/src/announce.rs | 9 +++++++-- crates/ui-egui/src/lib.rs | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/crates/ui-egui/src/announce.rs b/crates/ui-egui/src/announce.rs index 85a705d325..82841341dc 100644 --- a/crates/ui-egui/src/announce.rs +++ b/crates/ui-egui/src/announce.rs @@ -66,7 +66,9 @@ fn describe(app: &WordApp, id: &str) -> Option { if matches!(id, "format.growFont" | "format.shrinkFont" | "format.growFont1" | "format.shrinkFont1") { // A selection of mixed sizes has no one size to say. let size = state().get("size").and_then(Value::as_f64)?; - return Some(format!("{} {}", tl!("Font"), format_args!("{}{}", wordcraft_geom::Unit::Points.number(size as f32, app.session.region().decimal()), crate::options::unit_suffix(wordcraft_geom::Unit::Points)))); + let unit = wordcraft_geom::Unit::Points; + let number = unit.number(size as f32, app.session.region().decimal()); + return Some(format!("{} {number}{}", tl!("Font"), crate::options::unit_suffix(unit))); } None } @@ -274,7 +276,10 @@ mod tests { h.state_mut().ui.language = "pseudo".into(); let said = press(&mut h, Modifiers::COMMAND, Key::B).map(|(t, _)| t).unwrap_or_default(); crate::i18n::apply_language(crate::i18n::Lang::EN); - assert!(said.split_whitespace().all(|word| word.starts_with('⟦') && word.ends_with('⟧')) && said.contains('⟦'), "every word is marked: {said:?}"); + assert!( + said.split_whitespace().all(|word| word.starts_with('⟦') && word.ends_with('⟧')) && said.contains('⟦'), + "every word is marked: {said:?}" + ); } /// Ten presses in a burst, one per frame or all in one frame (a held key, or keys typed diff --git a/crates/ui-egui/src/lib.rs b/crates/ui-egui/src/lib.rs index 2c3303fec4..19f442d2d8 100644 --- a/crates/ui-egui/src/lib.rs +++ b/crates/ui-egui/src/lib.rs @@ -101,8 +101,8 @@ pub use dialogs::dialogs_ribbon; pub use dialogs::dialogs_smart_art; pub use file_dialogs::open_filters; -mod app; mod announce; +mod app; mod services; mod state; From e4f17d8dcc801d43204e01e9c8d56542af1335ff Mon Sep 17 00:00:00 2001 From: FredApps Date: Fri, 20 Nov 2026 15:39:58 +0100 Subject: [PATCH 6/7] Distinguish formatting announcements from status-bar live regions in regressions --- crates/ui-egui/src/announce.rs | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/crates/ui-egui/src/announce.rs b/crates/ui-egui/src/announce.rs index 82841341dc..fbfd6ef9b6 100644 --- a/crates/ui-egui/src/announce.rs +++ b/crates/ui-egui/src/announce.rs @@ -93,7 +93,7 @@ pub(crate) fn expose(app: &WordApp, ctx: &egui::Context) { #[cfg(test)] mod tests { - use egui::accesskit::Live; + use egui::accesskit::{Live, Role}; use egui::{Key, Modifiers}; use egui_kittest::kittest::{NodeT, Queryable}; use serde_json::json; @@ -135,7 +135,7 @@ mod tests { /// The live region's text and node (its id, written out), if one is in the tree. The text is /// the label's value, which is its name to screen readers. fn heard(h: &egui_kittest::Harness<'_, WordApp>) -> Option<(String, String)> { - let node = h.query_by(|n| n.live() == Live::Polite)?; + let node = h.query_by(|n| n.role() == Role::Label && n.accesskit_node().data().live() == Some(Live::Polite))?; let n = node.accesskit_node(); assert!(n.label_comes_from_value(), "a label, named by its value"); Some((n.value().unwrap_or_default(), format!("{:?}", n.id()))) @@ -273,6 +273,17 @@ mod tests { #[test] fn the_words_go_through_the_interface_catalogs() { let mut h = harness("Lanterns glow"); + // These delimiters mark translations in the synthetic locale and are absent from some test fonts. + h.ctx.add_glyph_rasterizer(egui::GlyphRasterizer::new("wordcraft::announce::pseudo_markers", |request| { + matches!(request.cluster, "⟦" | "⟧").then(|| egui::RasterizedGlyph { + bitmap: egui::GlyphBitmap { + image: egui::ColorImage::new([1, 1], vec![egui::Color32::WHITE]), + offset_px: egui::Vec2::ZERO, + is_color: false, + }, + advance_px: request.font_size_px.max(1.0), + }) + })); h.state_mut().ui.language = "pseudo".into(); let said = press(&mut h, Modifiers::COMMAND, Key::B).map(|(t, _)| t).unwrap_or_default(); crate::i18n::apply_language(crate::i18n::Lang::EN); @@ -287,7 +298,9 @@ mod tests { /// each replaces the last (`WordApp::announcement` holds one), so nothing queues up. #[test] fn a_burst_of_ten_presses_leaves_one_announcement_the_latest() { - let live = |h: &egui_kittest::Harness<'_, WordApp>| h.query_all_by(|n| n.live() == Live::Polite).count(); + let live = |h: &egui_kittest::Harness<'_, WordApp>| { + h.query_all_by(|n| n.role() == Role::Label && n.accesskit_node().data().live() == Some(Live::Polite)).count() + }; let mut h = harness("Lanterns glow"); let mut nodes = std::collections::HashSet::new(); for i in 0..10 { From ec8f946621d002cbcb79408ba417646b6125c282 Mon Sep 17 00:00:00 2001 From: FredApps Date: Fri, 20 Nov 2026 15:49:19 +0100 Subject: [PATCH 7/7] Read explicit live properties directly from the AccessKit predicate node --- crates/ui-egui/src/announce.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/crates/ui-egui/src/announce.rs b/crates/ui-egui/src/announce.rs index fbfd6ef9b6..ab5f9d2a28 100644 --- a/crates/ui-egui/src/announce.rs +++ b/crates/ui-egui/src/announce.rs @@ -135,7 +135,7 @@ mod tests { /// The live region's text and node (its id, written out), if one is in the tree. The text is /// the label's value, which is its name to screen readers. fn heard(h: &egui_kittest::Harness<'_, WordApp>) -> Option<(String, String)> { - let node = h.query_by(|n| n.role() == Role::Label && n.accesskit_node().data().live() == Some(Live::Polite))?; + let node = h.query_by(|n| n.role() == Role::Label && n.data().live() == Some(Live::Polite))?; let n = node.accesskit_node(); assert!(n.label_comes_from_value(), "a label, named by its value"); Some((n.value().unwrap_or_default(), format!("{:?}", n.id()))) @@ -298,9 +298,8 @@ mod tests { /// each replaces the last (`WordApp::announcement` holds one), so nothing queues up. #[test] fn a_burst_of_ten_presses_leaves_one_announcement_the_latest() { - let live = |h: &egui_kittest::Harness<'_, WordApp>| { - h.query_all_by(|n| n.role() == Role::Label && n.accesskit_node().data().live() == Some(Live::Polite)).count() - }; + let live = + |h: &egui_kittest::Harness<'_, WordApp>| h.query_all_by(|n| n.role() == Role::Label && n.data().live() == Some(Live::Polite)).count(); let mut h = harness("Lanterns glow"); let mut nodes = std::collections::HashSet::new(); for i in 0..10 {