mirror of
https://github.com/storytold/wordcraft.git
synced 2026-11-25 07:13:30 -06:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0280cf2f33 |
@@ -1,69 +0,0 @@
|
||||
# Accessibility
|
||||
|
||||
Source: `standards/app-accessibility.md` in [storytold/craft-contrib](https://github.com/storytold/craft-contrib/blob/main/standards/app-accessibility.md); do not edit this copy directly. Propose changes to the shared statement in [`storytold/craft-contrib`](https://github.com/storytold/craft-contrib).
|
||||
|
||||
We want people who use screen readers, braille displays, screen magnifiers, voice control, high contrast, large text, reduced motion, or keyboard navigation to be able to get their work done in the Craft applications.
|
||||
|
||||
## Supported environments and how accessibility works
|
||||
|
||||
The Craft applications draw their own interface in Rust with `egui` and expose accessibility information through **AccessKit**:
|
||||
|
||||
- **Windows:** UI Automation (for tools such as NVDA, JAWS, and Narrator)
|
||||
- **macOS:** NSAccessibility (VoiceOver)
|
||||
- **Linux and FreeBSD:** AT-SPI (Orca)
|
||||
- **Web (WebAssembly):** Browser accessibility tree in modern evergreen browsers
|
||||
- **Display and motion:** Light and dark themes, along with ongoing work to honour system high-contrast, text-scaling, and reduced-motion settings
|
||||
- **Headless and command-line workflows:** Most Craft applications also ship a command-line and automation binary (`<app>-cli`) that can inspect and edit documents from a terminal without using the graphical interface; see [This application](#this-application) below
|
||||
|
||||
**Current status:** The Craft suite is in early-alpha development. We use WCAG 2.2 and W3C's [WCAG2ICT](https://www.w3.org/TR/wcag2ict-22/) as practical reference points for user needs ([RFC-0014](https://github.com/storytold/craft-contrib/blob/main/rfcs/0014-accessibility.md)), while manual testing with assistive technologies across every tool and surface is still in progress.
|
||||
|
||||
## Known limitations and workarounds
|
||||
|
||||
Shared framework improvements are tracked in [storytold/craft-libs#437](https://github.com/storytold/craft-libs/issues/437). Current suite-wide gaps include:
|
||||
|
||||
- **Custom drawn surfaces (canvases, pages, grids, timelines, node graphs, and layer lists):** Some custom-painted views do not yet publish complete `AccessKit` nodes, caret bounds for magnifiers, or editable states (for example, `AccessKit`'s Windows adapter reporting `Document` nodes as read-only, which can prevent typing echo in screen readers). *Workaround:* Use structured inspector panels where available, or run headless commands through `<app>-cli` when a task does not need direct canvas interaction.
|
||||
- **Focus in menus, toolbars, and dialogs:** Some popups, menus, or keyboard access-key overlays may leave focus in the underlying document or not yet restore focus cleanly when dismissed. *Workaround:* Press `Escape` to close open popups, `Alt` or `F10` for menu/toolbar navigation, and `F6` to move between major regions where supported.
|
||||
- **Unannounced state changes:** Shortcuts or background tasks that change state away from focus do not yet consistently announce updates through a live region.
|
||||
- **Pointer-heavy interactions:** Certain timeline, node-wiring, or object-placement gestures do not yet have non-dragging keyboard alternatives.
|
||||
|
||||
See [This application](#this-application) below for repository-specific links and details.
|
||||
|
||||
## Reporting an accessibility barrier
|
||||
|
||||
If you run into an accessibility barrier, please open an issue using the link in [This application](#this-application) below (or let us know in the [ArtCraft Discord](https://discord.gg/artcraft) if GitHub's issue form gets in the way).
|
||||
|
||||
- **No personal disclosure needed:** You never have to disclose a disability or explain why you use assistive technology.
|
||||
- **Screenshots and recordings are optional:** Plain-text descriptions are always welcome and sufficient.
|
||||
- **Helpful details to share (when convenient):**
|
||||
- What you were trying to do, what happened, and what you expected
|
||||
- Application version (or commit) and operating system or browser
|
||||
- Input method, display settings, or assistive technology and version (for example, NVDA, JAWS, Narrator, VoiceOver, Orca, screen magnifier, high contrast, text scaling, or keyboard-only)
|
||||
|
||||
## How we respond
|
||||
|
||||
- **Triage and labels:** Maintainers and triagers label barrier reports with `accessibility` and set priority during triage based on impact—barriers that block a core workflow are treated as high-priority bugs, and barriers that risk losing work are critical.
|
||||
- **Assistive-technology verification (`needs screen reader test`):** Pull requests that fix a reported assistive-technology barrier or add custom accessibility-tree or focus behaviour are labelled `needs screen reader test` so someone using assistive technology can verify a build and share what they observed; if the barrier remains, we reopen the issue.
|
||||
|
||||
## Note for contributors and coding agents
|
||||
|
||||
`ACCESSIBILITY.md` is a user-facing overview, **not** an extra rule set or audit checklist for coding agents:
|
||||
|
||||
- **Follow `AGENTS.md` and [`standards/accessibility.md`](https://github.com/storytold/craft-contrib/blob/main/standards/accessibility.md) for engineering work,** and keep every pull request scoped strictly to its issue. Do not widen an unrelated change to audit or rework surrounding UI.
|
||||
- **Design for the actual user need—do not overbuild or apply naive readings of standards.** Accessibility guidelines exist to support real workflows and give flexible ways to meet them. Understand what a criterion genuinely requires in context before changing UI: for example, a button whose label or icon is legible and whose focus or selection ring already has clear contrast does **not** need its resting fill or border restyled to hit a 3:1 ratio, and inherently spatial or freehand tools should not have artificial keyboard grids bolted onto them.
|
||||
- **Preserve visual design and shared primitives.** Use shared theme tokens and shared widgets from `storytold/craft-libs` instead of inventing one-off styling, contrast overrides, focus shims, or live-region scaffolding inside an application.
|
||||
- **Be candid in pull requests.** Automated accessibility-tree checks never prove a change works with a real screen reader; describe only what was actually verified.
|
||||
|
||||
## Ownership
|
||||
|
||||
Maintained by the `craft-app-team` maintainers in [`storytold`](https://github.com/storytold). Shared updates belong in [`storytold/craft-contrib`](https://github.com/storytold/craft-contrib); repository-specific facts follow below.
|
||||
|
||||
## This application
|
||||
|
||||
**WordCraft** (`storytold/wordcraft`) is an open-source word processor written in pure Rust.
|
||||
|
||||
- **Published application builds:** macOS, Windows, Linux, FreeBSD, and Web (WebAssembly)
|
||||
- **Command-line and automation interface:** `wordcraft-cli` provides headless terminal and automation access for scripted workflows without the graphical interface
|
||||
- **Report an accessibility barrier:** [Open an issue in `storytold/wordcraft`](https://github.com/storytold/wordcraft/issues/new)
|
||||
- **Tracked accessibility issues:** [Open issues labelled `accessibility` in `storytold/wordcraft`](https://github.com/storytold/wordcraft/issues?q=is%3Aissue+state%3Aopen+label%3Aaccessibility)
|
||||
- **Pull requests awaiting assistive-technology verification:** [Pull requests labelled `needs screen reader test` in `storytold/wordcraft`](https://github.com/storytold/wordcraft/pulls?q=is%3Apr+label%3A%22needs+screen+reader+test%22)
|
||||
- **Contributor and agent rules for this repository:** [`AGENTS.md`](AGENTS.md)
|
||||
@@ -8,7 +8,7 @@ use craft::ui::buttons::{Arrangement, Button, IconButton};
|
||||
use craft::ui::contract::{ActivateOn, BodyCx, CollectionEvent, Gap, Props as _, SelectMode, Show as _, ShowCollection as _, ShowContainer as _};
|
||||
use craft::ui::display::Divider;
|
||||
use craft::ui::layout_components::Stack;
|
||||
use craft::ui::list::ThumbAspect;
|
||||
use craft::ui::list::{ThumbAspect, ThumbSize};
|
||||
use craft::ui::menu::{Menu, MenuItem};
|
||||
use craft::ui::primitives::{HAlign, IconSpec, TextRun};
|
||||
use craft::ui::tile_grid::{CaptionPlace, Tile, TileGrid};
|
||||
@@ -286,7 +286,61 @@ pub(super) fn insert(row: &mut RibbonRow<'_>, app: &mut WordApp) {
|
||||
});
|
||||
}
|
||||
|
||||
/// The recent and common characters as a grid of six per row; a click inserts the character, remembers it and closes
|
||||
/// The Unicode names (Unicode Standard, UnicodeData.txt) of the characters the grid offers first. No Unicode-names
|
||||
/// crate is installed, and the one on crates.io is under Unicode-DFS-2016, which the licence allowlist lacks.
|
||||
const SYMBOL_NAMES: &[(char, &str)] = &[
|
||||
('\u{A9}', "COPYRIGHT SIGN"),
|
||||
('\u{AE}', "REGISTERED SIGN"),
|
||||
('\u{2122}', "TRADE MARK SIGN"),
|
||||
('\u{A7}', "SECTION SIGN"),
|
||||
('\u{B6}', "PILCROW SIGN"),
|
||||
('\u{20AC}', "EURO SIGN"),
|
||||
('\u{A3}', "POUND SIGN"),
|
||||
('\u{A5}', "YEN SIGN"),
|
||||
('\u{B0}', "DEGREE SIGN"),
|
||||
('\u{B1}', "PLUS-MINUS SIGN"),
|
||||
('\u{2260}', "NOT EQUAL TO"),
|
||||
('\u{2264}', "LESS-THAN OR EQUAL TO"),
|
||||
('\u{2265}', "GREATER-THAN OR EQUAL TO"),
|
||||
('\u{F7}', "DIVISION SIGN"),
|
||||
('\u{D7}', "MULTIPLICATION SIGN"),
|
||||
('\u{221E}', "INFINITY"),
|
||||
('\u{B5}', "MICRO SIGN"),
|
||||
('\u{3B1}', "GREEK SMALL LETTER ALPHA"),
|
||||
('\u{3B2}', "GREEK SMALL LETTER BETA"),
|
||||
('\u{3C0}', "GREEK SMALL LETTER PI"),
|
||||
('\u{3A9}', "GREEK CAPITAL LETTER OMEGA"),
|
||||
('\u{2211}', "N-ARY SUMMATION"),
|
||||
('\u{221A}', "SQUARE ROOT"),
|
||||
('\u{2192}', "RIGHTWARDS ARROW"),
|
||||
('\u{2190}', "LEFTWARDS ARROW"),
|
||||
('\u{2713}', "CHECK MARK"),
|
||||
('\u{2605}', "BLACK STAR"),
|
||||
('\u{2665}', "BLACK HEART SUIT"),
|
||||
('\u{2014}', "EM DASH"),
|
||||
('\u{2026}', "HORIZONTAL ELLIPSIS"),
|
||||
];
|
||||
|
||||
/// A symbol's hover text: its Unicode name and code point (the code point alone, with its block, for a character
|
||||
/// not named above), then its font when it has one.
|
||||
pub(super) fn symbol_tip(glyph: &str, font: &str) -> String {
|
||||
let mut chars = glyph.chars();
|
||||
let tip = match (chars.next(), chars.next()) {
|
||||
(Some(c), None) => {
|
||||
let name = SYMBOL_NAMES.iter().find(|(n, _)| *n == c).map(|(_, name)| *name);
|
||||
let block = crate::dialogs_insert::subset_of(c);
|
||||
match (name, block) {
|
||||
(Some(name), _) => format!("{name} (U+{:04X})", c as u32),
|
||||
(None, Some(block)) => format!("U+{:04X} ({block})", c as u32),
|
||||
(None, None) => format!("U+{:04X}", c as u32),
|
||||
}
|
||||
}
|
||||
_ => glyph.to_string(),
|
||||
};
|
||||
if font.is_empty() { tip } else { format!("{tip}, {font}") }
|
||||
}
|
||||
|
||||
/// The recent and common characters as a compact grid; a click inserts the character, remembers it and closes
|
||||
/// the menu.
|
||||
fn symbol_grid(ui: &mut Ui, cx: &mut BodyCx<'_>, app: &mut WordApp) {
|
||||
// Recently used symbols first (their font on hover), then common ones.
|
||||
@@ -305,19 +359,20 @@ fn symbol_grid(ui: &mut Ui, cx: &mut BodyCx<'_>, app: &mut WordApp) {
|
||||
.activate(ActivateOn::Click)
|
||||
.caption(CaptionPlace::None)
|
||||
.card_columns(6)
|
||||
.content_cells()
|
||||
// Small cells (#7165): a glyph needs no more room than the small thumbnail step.
|
||||
.thumb_size(ThumbSize::Small)
|
||||
// At most thirty symbols, all shown; the menu's body is the one scroll.
|
||||
.natural_height(true)
|
||||
.show_items(ui, &SymbolCells(items.len()), &mut |key, _| {
|
||||
let (c, font) = items.get(*key).cloned().unwrap_or_default();
|
||||
let glyph = c.clone();
|
||||
let (glyph, tip) = (c.clone(), symbol_tip(&c, &font));
|
||||
let tile = Tile::new(c).thumb(ThumbAspect::SQUARE, move |cx, rect| {
|
||||
let run = TextRun::new(glyph.as_str()).align(HAlign::Center);
|
||||
cx.with_draw(|d| {
|
||||
d.text_on_centre_line(rect, &run);
|
||||
});
|
||||
});
|
||||
if font.is_empty() { tile } else { tile.tooltip(font) }
|
||||
tile.tooltip(tip)
|
||||
});
|
||||
for event in &out.response.events {
|
||||
if let CollectionEvent::Activate(key) = event
|
||||
|
||||
@@ -994,3 +994,27 @@ fn decorative_text_dropdown_renders_compact_wordart_tiles() {
|
||||
rect.height()
|
||||
);
|
||||
}
|
||||
|
||||
/// #7165: the Symbol drop-down's cells are compact (a thumbnail-small step, not a card) and the hover text names
|
||||
/// the character, not just the glyph.
|
||||
#[test]
|
||||
fn symbol_menu_cells_are_compact_and_the_tooltip_names_the_character() {
|
||||
let app = WordApp::new(Session::new(wordcraft_doc::Document::from_text("Text")), crate::Services::default());
|
||||
let mut h = tab_harness(app, "Insert");
|
||||
click_button(&mut h, "Symbol");
|
||||
let cell = h.get_by_label("\u{A9}").rect();
|
||||
assert!(cell.width() <= 80.0 && cell.height() <= 80.0, "a symbol cell is compact, got {:?}", cell.size());
|
||||
h.get_by_label("\u{A9}").hover();
|
||||
crate::test_harness::frames(&mut h, 40);
|
||||
assert!(h.query_by_label_contains("COPYRIGHT SIGN (U+00A9)").is_some(), "the tooltip names the character");
|
||||
}
|
||||
|
||||
/// Characters outside the common list still say what they are: code point and block.
|
||||
#[test]
|
||||
fn symbol_tip_names_known_characters_and_falls_back_to_the_code_point() {
|
||||
use super::insert::symbol_tip;
|
||||
assert_eq!(symbol_tip("\u{A9}", ""), "COPYRIGHT SIGN (U+00A9)");
|
||||
assert_eq!(symbol_tip("\u{3B1}", "Symbol"), "GREEK SMALL LETTER ALPHA (U+03B1), Symbol");
|
||||
assert_eq!(symbol_tip("\u{2602}", ""), "U+2602 (Miscellaneous Symbols)");
|
||||
assert_eq!(symbol_tip("", ""), "");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user