Skip to content
Source
Sign inSign up
pingdotgg/t3code

feat(mobile): long-press file references for path and open actions #9258

Mergedjuliusmarmingemerged 4 commits intomain fromrefs/pull/9258/headmerged by juliusmarminge View on GitHub

juliusmarmingecommented

What changed

  • File chips in iOS messages get a native long-press context menu with Copy full path, Copy relative path, and Open in file viewer, the same actions the web chip offers on right-click.
  • T3MarkdownTextRun accepts a JSON contextMenuConfig; T3MarkdownText maps runs that carry one to UITextItem links so iOS 17's text-item menu owns the gesture. Tap and text selection keep working; text drag is disabled on chat text.
  • SelectableMarkdownText gains fileContextMenu and onFileContextMenuAction. The feed builds the menu description and runs actions from one handler at the root, so rows subscribe to nothing extra per chip.

Why

Tapping a file reference opened it and that was the only thing you could do with it. Users copying a path had to open the file first. Web has had a chip context menu for a while; this brings the same set to iOS through UIKit rather than a JS action sheet.

Split out of #9253 so the media refactor there stays a refactor.

UI changes

Before: tap only After: native context menu
No long-press affordance on file chips.

Testing

  • fileChipMenu.test.ts (5 tests)
  • Mobile typecheck, lint, and format on changed files

Created with Claude Fable 5 using the Claude Code harness in T3 Code.

🤖 Generated with Claude Code


Note

Medium Risk Touches native gesture handling and iOS 17 text-item menus on chat text; disabling text drag and suppressing recognizers on menu runs could affect edge-case interactions outside file chips.

Overview Adds native long-press context menus on iOS for inline file references in chat markdown, matching web chip actions: copy full path, copy relative path, and open in the file viewer.

The t3-markdown-text native layer now accepts a JSON contextMenuConfig on text runs, builds a UIMenu, and wires T3MarkdownText (iOS 17 text-item delegates) so menu runs are exposed as links while custom tap/long-press is skipped on those runs. Chat UITextView also disables text drag. SelectableMarkdownText gains fileContextMenu / onFileContextMenuAction plus a React context so file chips in the tree share one handler.

ThreadFeed centralizes tap and menu behavior in markdownLinkHandlers via new fileChipMenu / resolveFileChipTarget. resolveWorkspaceRelativeFilePath now rejects paths that escape the workspace with .. (e.g. /repo/../outside.txt). User docs note iOS touch-and-hold on file references.

Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 67b0275618c923f77ecf1226e73e094b40f29204. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).

Note

Add long-press context menu for file references in mobile markdown text

  • Native iOS T3MarkdownText and T3MarkdownTextRun build context menus from a serialized JSON config and emit a native event when an action is selected. Custom tap/long-press recognizers are suppressed on runs with a menu, while other runs keep existing gesture handling.
  • React Native wiring in SelectableMarkdownText.ios.tsx and ThreadFeed.tsx resolves file-chip hrefs to menus and dispatches copy-path and open-file actions.
  • fileChipMenu.ts classifies file links into full and relative paths and builds a menu with only the supported copy actions plus the file-viewer open action.
  • filePath.ts now rejects absolute targets that escape the workspace via a .. segment instead of normalizing them.
  • Risk: disabling drag interaction on T3MarkdownText means text drag-and-drop no longer works on iOS; handleLongPressIfNecessary now fires once at the began state rather than across all long-press transitions.
Macroscope summarized 67b0275.
    1. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted

    2. github-actions[bot](GitHub profile, opens in a new tab) added labels📱 Native Change

    3. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      🟡 Medium

      https://github.com/pingdotgg/t3code/blob/c8b9699fbb536227fd2134b28b1518951d310e53/apps/mobile/modules/t3-markdown-text/src/SelectableMarkdownText.ios.tsx#L76

      File chips inside rich blocks such as blockquotes, lists, and tables cannot invoke fileContextMenu or onFileContextMenuAction; they retain tap-only behavior because this NativeMarkdownBlock path receives neither handler. Thread both props through NativeMarkdownBlock and its SelectableNode calls so rich-block chips receive the same menu behavior as top-level paragraph chips.

      Also found in 1 other location(s)

      apps/mobile/src/features/threads/ThreadFeed.tsx:916

      AssistantMarkdownContent passes the new menu handlers into SelectableMarkdownText, but its rich-block path drops them: SelectableMarkdownText.ios.tsx renders NativeMarkdownBlock without fileContextMenu or onFileContextMenuAction, and that block's SelectableNode forwards only onLinkPress. Consequently a file chip inside a blockquote, table, or another rich block still renders and opens on tap, but has no long-press menu, unlike a top-level paragraph file chip.

      🚀 Reply "fix it for me" or copy this AI Prompt for your agent:
      In file @apps/mobile/modules/t3-markdown-text/src/SelectableMarkdownText.ios.tsx around line 76:
      
      File chips inside rich blocks such as blockquotes, lists, and tables cannot invoke `fileContextMenu` or `onFileContextMenuAction`; they retain tap-only behavior because this `NativeMarkdownBlock` path receives neither handler. Thread both props through `NativeMarkdownBlock` and its `SelectableNode` calls so rich-block chips receive the same menu behavior as top-level paragraph chips.
      
      Also found in 1 other location(s):
      - apps/mobile/src/features/threads/ThreadFeed.tsx:916 -- `AssistantMarkdownContent` passes the new menu handlers into `SelectableMarkdownText`, but its rich-block path drops them: `SelectableMarkdownText.ios.tsx` renders `NativeMarkdownBlock` without `fileContextMenu` or `onFileContextMenuAction`, and that block's `SelectableNode` forwards only `onLinkPress`. Consequently a file chip inside a blockquote, table, or another rich block still renders and opens on tap, but has no long-press menu, unlike a top-level paragraph file chip.
      
    4. Fixed in d16245c58.

    5. github-actions[bot](GitHub profile, opens in a new tab)commented

      Thread transfer impact

      ✅ Thread transfer remains within every enforced ceiling.

      ProviderMetricMain baselineThis PRImpactPR ceiling
      CodexTotal thread wire13.2 KiB13.1 KiB−88 B (−0.6%)15.1 KiB✅
      CodexThread snapshot wire6.9 KiB6.9 KiB+4 B (+0.1%)7.3 KiB✅
      CodexLive turn WebSocket wire6.3 KiB6.2 KiB−92 B (−1.4%)7.8 KiB✅
      CodexLive turn WebSocket decoded55.5 KiB54.7 KiB−822 B (−1.4%)66.4 KiB✅
      CodexLive turn messages880 (0.0%)21✅
      ClaudeTotal thread wire13.3 KiB13.3 KiB+12 B (+0.1%)15.1 KiB✅
      ClaudeThread snapshot wire6.9 KiB6.9 KiB−3 B (−0.0%)7.3 KiB✅
      ClaudeLive turn WebSocket wire6.4 KiB6.4 KiB+15 B (+0.2%)7.8 KiB✅
      ClaudeLive turn WebSocket decoded56.4 KiB56.4 KiB0 B (0.0%)66.4 KiB✅
      ClaudeLive turn messages10100 (0.0%)21✅

      Baseline: aab4049 · PR result: 67b0275 · Source CI: success

      Scenario and decoded snapshot size

      10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.

      • Codex decoded thread snapshot: 109.4 KiB
      • Claude decoded thread snapshot: 110.1 KiB

      Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.

    6. Approvability

      Verdict: Not approved

      Macroscope's review found this PR not approvable — This adds a new iOS long-press workflow through native UIKit text-item menus and bridges actions into production message rendering. It also disables text drag-and-drop and changes gesture handling for the shared markdown text component, giving the change a broader interaction surface than a simple UI adjustment.

      You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    7. juliusmarminge merged this9159b80

    8. juliusmarminge closed this

Sign in to join this conversation.