Skip to content

feat(apps): render collapsible details natively - #115641

Merged
steipete merged 7 commits into
mainfrom
steipete/native-collapsible-details
Jul 29, 2026
Merged

steipete merged 7 commits into
mainfrom
steipete/native-collapsible-details

Conversation

@steipete

Copy link
Copy Markdown
Contributor

Related: #114556
Related: #114706

What Problem This Solves

Fixes an issue where native app users would see raw <details> markup when a model authored a collapsible section. Native apps use the same webchat session channel as the web client but render messages natively: iOS and macOS printed the tags literally through AttributedString, while Android rendered the HtmlBlock verbatim in monospace.

Why This Change Was Made

This follow-up to #114556 and #114706 adds native disclosure rendering while keeping the same recognition contract as the web block rule. SwiftUI uses DisclosureGroup through a new .disclosure case in the shared block segmenter and renderer, covering iOS main chat, macOS main chat, and macOS Quick Chat; Android uses a Compose expandable; and the macOS onboarding/system-agent chat now uses the shared renderer instead of its weaker per-line parser.

Recognition is line-start anchored and accepts only strict <details>, <details open>, <summary>, and </details> tags. Unsupported attributes still balance but render literally, nesting is capped at 32, CommonMark raw-HTML block types 1-5 are protected, and unclosed disclosures fold implicitly while streaming. Authored summaries are never localized; only an omitted summary uses the localized "Details" fallback.

User Impact

iOS, macOS, and Android users now see model-authored collapsible sections as native expandable controls instead of raw HTML tags. Reference-style links resolve in disclosure bodies but deliberately not in summaries, avoiding fragile cross-fragment document splicing.

Evidence

  • Autoreview ran six times across the branch, with every accepted finding fixed.
  • check:changed apps lane exited 0.
  • Swift focused proof passed 107 tests, and SwiftLint was clean. After rebasing onto current origin/main, the 107-test ChatMarkdownBlockSegmenterTests suite passed again.
  • Android JVM ChatMarkdownTest and ktlint completed with BUILD SUCCESSFUL. After the rebase, ChatMarkdownTest passed again.
  • iOS simulator build and macOS build succeeded.
  • git diff --check was clean.
  • Live verification installed the freshly built iOS app, paired and connected it to a scratch gateway on current main, and rendered the live session.

Known shared limitation: when CommonMark coalesces a type-6 HTML block that begins with another tag, for example <div>body</div> immediately followed by </details> with no blank line, the closing tag is swallowed into that block. The disclosure then implicitly closes only at the end of the message, nesting following content inside it. This behavior is pre-existing on web in ui/src/components/markdown-details.ts, shipped in #114556, and native is intentionally at parity here. A follow-up will fix both surfaces together.

Proof gap: an on-device screenshot of the collapsed disclosure could not be captured because the host xcode-select points at a broken Xcode beta, which disables the simulator-control MCP. The install, pairing, connection, and live-session render were verified, but the collapsed disclosure screenshot is not available.

@openclaw-barnacle openclaw-barnacle Bot added app: android App: android app: macos App: macos labels Jul 29, 2026
@steipete steipete self-assigned this Jul 29, 2026
@openclaw-barnacle openclaw-barnacle Bot added size: XL maintainer Maintainer-authored PR labels Jul 29, 2026
@steipete
steipete marked this pull request as ready for review July 29, 2026 05:59
@steipete
steipete merged commit 138675a into main Jul 29, 2026
99 checks passed
@steipete
steipete deleted the steipete/native-collapsible-details branch July 29, 2026 06:52
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Jul 29, 2026
…ifecycle-hooks

* origin/main:
  fix(ios): prevent duplicate native chat replies after tool runs (#115678)
  feat(apps): render collapsible details natively (#115641)
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 30, 2026
* feat(apps): render collapsible details natively in chat

* fix(apps): preserve reference definitions when folding disclosures

* fix(apps): keep authored details summaries unlocalized

* fix(apps): keep raw-HTML disclosure examples literal

* refactor(apps): isolate summaries and raw HTML contexts

* fix(apps): honor all CommonMark raw HTML contexts in disclosures

* chore(apps): refresh native i18n inventory for disclosure strings
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: android App: android app: macos App: macos maintainer Maintainer-authored PR size: XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant