Skip to content

Fix Writer Word media export, improve accessibility, and speed up manuscript assembly - #251

Merged
callumalpass merged 1 commit into
mainfrom
writer-docx-a11y-performance
Nov 28, 2026
Merged

callumalpass merged 1 commit into
mainfrom
writer-docx-a11y-performance

Conversation

@callumalpass

Copy link
Copy Markdown
Member

Changes

  • Install nested binary resources as WASI directories before Pandoc runs. Keep the original collection filenames in the export bundle and escape their Markdown destinations.
  • Fix low-contrast mobile sidebar badges and chapter numbers, keep outline headings clear of the sticky search, and restore keyboard focus from Word export review. The note picker exposes selectable buttons and the editor remains keyboard reachable with citation suggestions open.
  • Walk cross-reference protection ranges in document order and build the rewritten Markdown in one pass over the edits.

Word Markdown assembly benchmark

Fixture Samples per revision Before median After median Before p95 After p95
120 chapters, 5,000 available sources, 2,880 cited sources, 120 figures 20 3,414.89 ms 235.43 ms 3,472.47 ms 356.61 ms

Baseline 340d89e043cf9bd6988ab9df3b8b132d8e8162e1. Node 22.22.0 on the shared rpnpm builder, four warmups per revision. Timing covers materialize and cross-reference resolution with preloaded records. It excludes SDK hydration, fetching image bytes, Pandoc conversion and download. The fixture verifies the bibliography count, media map, chapter and figure numbering, and preservation of code spans.

# Run from this PR's worktree
baseline=$(mktemp -d)
git worktree add --detach "$baseline" 340d89e043cf9bd6988ab9df3b8b132d8e8162e1
fixture=apps/writer/scripts/perf/materialize.bench.ts
cp "$fixture" "$baseline/$fixture"
(cd "$baseline" && rpnpm --filter @mdbase-writer/app test:perf-fixture scripts/perf/materialize.bench.ts)
rpnpm --filter @mdbase-writer/app test:perf-fixture scripts/perf/materialize.bench.ts
rm -- "$baseline/$fixture"
git worktree remove "$baseline"

Validation

  • The worked example uploads figures/example.png through an SDK fixture client and exports from the Word menu. The downloaded ZIP contains byte-identical image data referenced by the document, a rendered citation in word/footnotes.xml, and the bibliography. The Node WASM test also extracts a chapter-relative PNG with spaces, Unicode and parentheses in its path.
  • All 24 local Chromium reliability scenarios, rpnpm check, benchmark typecheck and the production build passed.
  • The browser WASM build embeds SVG as vector media. It still reports that it cannot invoke the external SVG fallback rasterizer for older Word versions.
  • Local Chromium 149 and axe-core 4.14 reported zero violations across 90 scans at 390 × 844 and 1280 × 900 in light and dark. The sweep includes editor and preview, outline and search, sources and citation completion, Word export and review, offline checkpoint and recovery, settings, note adoption, and dialog focus. The audit records unresolved canvas contrast separately from its DOM assertions. Hosted production and assistive technology were outside the fixture.
rpnpm check
rpnpm --filter @mdbase-writer/app typecheck:perf
rpnpm --filter @mdbase-writer/app build:production
pnpm install --frozen-lockfile
pnpm dev --force
# In another shell with Chromium and unzip available
pnpm -C apps/writer test:browser:a11y
pnpm -C apps/writer test:browser:reliability
pnpm -C apps/writer test:browser:polish

@callumalpass
callumalpass merged commit 5b22cbf into main Nov 28, 2026
1 check passed
@callumalpass
callumalpass deleted the writer-docx-a11y-performance branch November 28, 2026 13:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant