Skip to content

[codex] Improve markdown accessibility and selection#82

Merged
zhuowcui merged 1 commit into
mainfrom
codex/markdown-accessibility-selection
May 16, 2026
Merged

[codex] Improve markdown accessibility and selection#82
zhuowcui merged 1 commit into
mainfrom
codex/markdown-accessibility-selection

Conversation

@Xueyang-Song

Copy link
Copy Markdown
Collaborator

Summary

This PR brings the WinUI markdown renderer much closer to native-control accessibility behavior and hardens the selection/clipboard path that shook out during manual testing.

What Changed

  • Added a semantic accessibility model and richer UIA peer tree for headings, paragraphs, links, images, lists, tables/cells, code blocks, and hosted embeds.
  • Implemented TextPattern support with document/visible ranges, movement, selection, bounding rectangles, range-from-point behavior, scroll-into-view, and word-sized Narrator rectangles.
  • Added high contrast/system theme integration, system FlowDirection helper support, localized automation/context strings, and native-looking focus/keyboard coordination across painted links and hosted WinUI controls.
  • Reworked text selection rendering onto a single stable Win2D adorner so selection uses native colors without repainting/shaking document text.
  • Fixed selection edge cases for thematic breaks, cross-page persistence, multi-control dismissal, table row-border hit-testing, and Ctrl+C after pointer selection.
  • Expanded sample automation and unit coverage, and updated markdown renderer docs/TODOs.

Root Causes Fixed

  • Narrator only saw a custom/root-like surface because text ranges and semantic peers were too flat.
  • Selection color/shake regressions came from painting selection in the document text layer or covering text without repainting selected foreground.
  • Table drag flicker came from table-gap hit testing returning the table container block index instead of a nearby real cell caret.
  • Ctrl+C after drag could miss the renderer because WinUI focus routing may remain on a stale element after pointer selection.

Validation

  • dotnet build MarkdownRenderer\MarkdownRenderer.Sample\MarkdownRenderer.Sample.csproj -p:Platform=x64 --no-restore
  • dotnet build MarkdownRenderer\MarkdownRenderer.Sample.Automation\MarkdownRenderer.Sample.Automation.csproj -p:Platform=x64 --no-restore
  • dotnet test MarkdownRenderer\MarkdownRenderer.Tests\MarkdownRenderer.Tests.csproj -p:Platform=x64 --no-restore -> 218 passed
  • Full sample automation run -> 26 passed, 0 failed
  • git diff --cached --check

Notes

Narrator screenshot artifacts generated during manual smoke testing are intentionally not included in this PR.

@zhuowcui zhuowcui marked this pull request as ready for review May 16, 2026 22:46
@zhuowcui zhuowcui merged commit ffef841 into main May 16, 2026
3 checks passed
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.

2 participants