Repository navigation
Avoid idle Markdown selection layout work - #1617
Merged
Alexandre Zollinger Chohfi (azchohfi) merged 9 commits intoNov 23, 2026
Merged
Alexandre Zollinger Chohfi (azchohfi) merged 9 commits into
Alexandre Zollinger Chohfi (azchohfi) merged 9 commits into
Conversation
Co-authored-by: Copilot App <[email protected]>
Barbara Kudiess (bkudiess)
requested a review
from Chris Anderson (codemonkeychris)
as a code owner
November 19, 2026 23:03
6 of 16 tasks
…ection-layout-performance
16 of 18 tasks
Alexandre Zollinger Chohfi (azchohfi)
left a comment
Collaborator
There was a problem hiding this comment.
Nice cut on the idle cost. Main thing is the TextChanged event on idle scopes, plus a couple of tests that call Refresh() directly and so miss the paths this changes.
Alexandre Zollinger Chohfi (azchohfi)
requested a balanced review from Copilot
November 20, 2026 01:43
Copilot started reviewing on behalf of
Alexandre Zollinger Chohfi (azchohfi)
November 20, 2026 01:43
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
UI Automation text-change notifications can be missed because modifier visibility changes do not invalidate the document and semantic-only updates can leave refreshes pending indefinitely.
2 open issues
What changed in this PR
This PR reduces idle work in Markdown text-selection scopes introduced by #1475, while preserving continuous layout tracking for active selection, dragging, and focused carets.
Changes:
- Makes idle document refresh demand-driven and caches per-owner geometry transforms.
- Adds idle-layout regression coverage and strengthens the streaming accessibility-event test.
- Documents the refresh behavior and continued support for one scope per message.
| File | Description |
|---|---|
tests/Reactor.AppTests/Tests/MarkdownSelectionInputProofTests.cs |
Checks idle streaming events without triggering a provider refresh. |
tests/Reactor.AppTests.Host/SelfTest/SelfTestFixtureRegistry.cs |
Registers the idle-layout fixture. |
tests/Reactor.AppTests.Host/SelfTest/Fixtures/MarkdownSelectionFixtures.cs |
Tests idle work, lazy refresh, transform caching, and active tracking. |
src/Reactor.Advanced/Markdown/MarkdownTextSelection.cs |
Narrows semantic invalidation and tracks marker lifecycle changes. |
src/Reactor.Advanced/Markdown/MarkdownSelectionHost.cs |
Adds demand-driven layout subscriptions and transform caching. |
docs/guide/text-and-media.md |
Explains idle and active refresh behavior. |
docs/_pipeline/templates/text-and-media.md.dt |
Updates the source template for the guide. |
CHANGELOG.md |
Records the idle-selection performance improvement. |
Review effort: Balanced
4 of 6 tasks
Co-authored-by: Copilot App <[email protected]>
Co-authored-by: Copilot App <[email protected]>
Co-authored-by: Copilot App <[email protected]>
Semantic-only changes such as a MarkdownTextSelection.Visibility gate do not invalidate layout, so the LayoutUpdated subscription never fired and UIA TextChanged listeners waited for unrelated layout work. Co-authored-by: Copilot App <[email protected]>
…ection-layout-performance # Conflicts: # CHANGELOG.md
Co-authored-by: Copilot App <[email protected]>
…ection-layout-performance # Conflicts: # CHANGELOG.md
Alexandre Zollinger Chohfi (azchohfi)
approved these changes
Nov 23, 2026
Alexandre Zollinger Chohfi (azchohfi)
merged commit Nov 23, 2026
035bc0b
into
microsoft:main
43 checks passed
Barbara Kudiess (bkudiess)
added a commit
to bkudiess/microsoft-ui-reactor
that referenced
this pull request
Nov 23, 2026
Integrate main including microsoft#1617 with the existing viewport-boundary and word/paragraph stationary autoscroll regressions. Preserve shared drag selection updates and message-clipped press acceptance. Co-authored-by: Copilot App <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Idle Markdown selection scopes no longer do membership, native-text, or geometry work on unrelated window layout passes. Refresh is demand-driven for idle scopes, with continuous tracking retained for active selection, drag, and focused caret; per-owner text transforms are cached during geometry work.
Linked issue / spec
Part of #1475 (Markdown text selection).
Test plan
Markdown_Selection_IdleLayoutCostselftest, exercising 24 scopes against unrelated layout and streamed content; 104 Markdown selection selftest assertions passed across five fixtures.dotnet test tests/Reactor.Tests --no-build -p:Platform=x64 --filter-class '*MarkdownTextSelectionTests*'— passed (73 tests).dotnet test tests/Reactor.AppTests --no-build -p:Platform=x64 --filter 'ClassName=Microsoft.UI.Reactor.AppTests.Tests.MarkdownSelectionInputProofTests'— passed (real input and UIA event proof).dotnet build src/Reactor.Advanced --no-restore -c Release -p:Platform=x64 -p:SkipSignaturesGen=true -m:1 -nodereuse:false -v:quiet— passed.Risk / breaking changes
No public API or consumer-pattern change; one
Scopeper message remains supported inItemsView. Active scopes intentionally retain layout-time native text validation. Idle UIA text-change listeners schedule a coalesced refresh when semantic content changes.