Skip to content

Custom cross-control selection engine so the whole chat transcript is drag-selectable #995

Closed as not planned

Description

@karkarl

Problem

Chat messages render markdown into a FunctionalUI Element tree. Prose (paragraphs + headings) and now simple lists coalesce into a single per-message RichTextBlock so they are one continuous drag-selection scope (branch karkarl-chat-bubble-richtextblock, commit 47b335d, follow-up to 2fa7279). However, selection is still fragmented at every styled island:

  • Code blocks, tables, block quotes, thematic breaks, and any complex list (an item containing one of those) render as their own controls and are their own selection islands.
  • You cannot drag-select from one message into another, or across a code block, in one gesture.

This is a hard WinUI limitation, confirmed during the RichTextBlock work:

  • InlineUIContainer breaks text selection at its boundary and is excluded from SelectedText, so styled cards cannot be embedded in-flow without losing selection.
  • There is no built-in mechanism for continuous selection spanning multiple sibling controls.
  • TextHighlighter keeps text in-flow and selectable but only hugs glyphs per line (no padding/border/rounded corners/scroll), so it cannot preserve code-card chrome.

The per-message Copy button is the current whole-message grab affordance, and simple lists + prose now select as one block — this issue tracks going the rest of the way.

Goal

Whole-transcript (or at least whole-message, spanning styled islands) continuous selection, while keeping code blocks / tables / block quotes as separately styled, chrome-bearing surfaces.

Approach (to design)

Build a custom selection manager plus a custom UI Automation ITextProvider / ITextRangeProvider over the chat surface so a single drag maps to a logical text range that crosses control boundaries:

  • Hit-test + anchor/focus tracking across child controls (prose RichTextBlocks + island cards).
  • A logical document/offset model that stitches the rendered blocks into one selectable stream (including code/table text).
  • Custom TextPattern provider for accessibility + Ctrl+C semantics that mirror the visible selection.
  • Painting the selection highlight across islands without the native per-control selection overlay fighting it.

Constraints

  • Keep the inert-markdown security posture (no Hyperlink/BitmapImage; AppendInlines stays inert).
  • Preserve the selection-preservation cache invariant (re-render/AST-reparse must not wipe an active selection).
  • Keep code/table/blockquote visual chrome intact.

References

  • Branch karkarl-chat-bubble-richtextblock, commits 2fa7279 (prose coalescing) and 47b335d (simple-list coalescing) — PR pending from this branch; cross-link once opened.
  • File: src/OpenClaw.Tray.WinUI/Chat/Markdown/ChatMarkdownRenderer.cs (coalescing + island rendering).

Out of scope

The RichTextBlock coalescing already landed. This issue is the larger custom-selection-engine follow-up.

Activity

  1. karkarl commented on Jul 15, 2026

    @karkarl
    CollaboratorAuthor

    Base implementation landed in #997 (per-message RichTextBlock coalescing prose + simple lists). This issue tracks the custom cross-control selection engine to extend selection across the styled islands (code/table/blockquote) that #997 leaves separate.

  2. added
    P3
    impact:ux-friction
    issue-rating: 🌊 off-meta tidepool
    clawsweeper:no-new-fix-pr
    clawsweeper:fix-shape-clear
    clawsweeper:needs-maintainer-review
    clawsweeper:needs-product-decision
    on Jul 16, 2026
  3. clawsweeper commented on Jul 16, 2026

    @clawsweeper

    Codex review: keeping this open for maintainer follow-up; there is still a little grit to resolve. Reviewed August 23, 2026, 8:20 AM ET / 12:20 UTC.

    Summary
    Keep open for a maintainer product decision. Current main has no custom cross-control selection or text-provider layer, and the prior per-message selection renderer is no longer the production chat path.

    Reproducibility: yes. for the missing custom engine: current source has no logical cross-control range or text-provider implementation. A current-head native-app capture is still needed to verify the exact Reactor Markdown drag behavior.

    Regression provenance
    Possible regression — suspected (reviewed change). No predecessor PR is attributed.

    Maintainer decision needed

    Question Recommendation
    Should the supported chat contract stop at per-message native selection plus Copy, or should OpenClaw fund a virtualized cross-control selection and UI Automation model across styled transcript content? Restore per-message baseline, defer transcript engine: Re-establish the earlier per-message selection behavior in the Reactor timeline, then consider cross-control selection only after a scoped accessibility design.

    Why: The proposed engine changes native selection, clipboard semantics, accessibility, and virtualized timeline ownership; current source does not establish those product choices.

    Next step
    A maintainer must choose the supported selection and accessibility scope before a large virtualized-selection implementation can be safely bounded.

    Review details

    Best possible solution:

    Decide the supported selection contract, restore and prove per-message native selection in the live Reactor path if it remains required, then design any transcript-wide range model with virtualization and UI Automation coverage.

    Do we have a high-confidence way to reproduce the issue?

    Yes for the missing custom engine: current source has no logical cross-control range or text-provider implementation. A current-head native-app capture is still needed to verify the exact Reactor Markdown drag behavior.

    Is this the best way to solve the issue?

    No, immediate implementation is not the best path. The production renderer no longer uses the earlier per-message coalescing path, so maintainers should first choose the supported baseline and transcript-selection scope.

    AGENTS.md: found and applied where relevant.

    Remaining risk / open question:

    • A transcript-wide custom selection and UI Automation layer must define behavior across virtualized rows, native selection, keyboard copy, and accessibility before implementation can safely begin.
    • Current source proves the requested custom layer is absent, but a native current-head drag-selection capture is still needed to establish the exact behavior of the Reactor Markdown dependency.

    Codex review notes: model internal, reasoning high; reviewed against ccd64bbb7d68.

    Label changes

    Label justifications:

    • P3: This is a non-blocking transcript interaction improvement, and whole-message Copy remains available.
    • impact:ux-friction: Fragmented selection makes partial copying awkward without preventing users from copying the entire message.
    Evidence reviewed

    What I checked:

    Likely related people:

    • calebeden: History attributes the production Reactor chat-surface cleanup to this author. (role: recent chat-surface refactor author; confidence: high; commits: d3ed6c78bf14, a76c85218c7d; files: src/OpenClaw.Tray.WinUI/Chat/ReactorChatTimeline.cs)
    • karkarl: The merged selection-scope work explicitly recorded this larger cross-control follow-up. (role: prior selection-scope feature contributor; confidence: high; commits: 4518dd87ed2b; files: src/OpenClaw.Tray.WinUI/Chat/Markdown/ChatMarkdownRenderer.cs)
    How this review workflow works
    • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
    • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
    • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
    • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
    • Maintainers can also comment @clawsweeper review to request a fresh review only.
    • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
    • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
    • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.
  4. added
    issue-rating: 🦞 diamond lobster
    clawsweeper:source-repro
    and removed
    clawsweeper:fix-shape-clear
    issue-rating: 🌊 off-meta tidepool
    on Jul 30, 2026
  5. 3 remaining items

  6. added
    clawsweeper:needs-live-repro
    issue-rating: 🦞 diamond lobster
    clawsweeper:source-repro
    issue-rating: 🐚 platinum hermit
    and removed
    issue-rating: 🐚 platinum hermit
    clawsweeper:needs-live-repro
    issue-rating: 🦞 diamond lobster
    clawsweeper:source-repro
    on Aug 2, 2026
  7. github-actions commented on Aug 23, 2026

    @github-actions
    Contributor

    This issue has been automatically marked as stale due to inactivity.
    Please add updated OpenClaw Windows details or it will be closed.

  8. github-actions commented on Aug 31, 2026

    @github-actions
    Contributor

    Closing due to inactivity.
    If this still affects OpenClaw Windows, open a new issue with the current version, logs, and fresh reproduction details.

  9. locked as resolved and limited conversation to collaborators on Sep 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3clawsweeper:needs-live-reproclawsweeper:needs-maintainer-reviewclawsweeper:needs-product-decisionclawsweeper:no-new-fix-primpact:ux-frictionissue-rating: 🐚 platinum hermitstale

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions