fix(mobile): show when highlighted code has been copied #48276
main fromrefs/pull/48276/head·opened View on GitHubProblem#
On my iPhone, tapping Copy code on a SQL block copied the query, but the button looked the same afterward. I confirmed the copy by pasting the query into the composer.
Change#
Use the mobile app’s existing CopyTextButton in the highlighted code block header. A successful copy shows a checkmark and changes the accessibility label to “Copied” for 1.2 seconds.
Scope#
Addresses the HighlightedCodeBlock portion of #43174, including SQL and Kotlin blocks. Other fences handled by the native enriched-markdown renderer have a separate copy control.
Verification#
- Exercised the original and updated React components with a mocked native clipboard. The original copied the exact multiline SQL and kept its copy icon. The updated button showed success only after the clipboard write resolved, then reset at 1.2 seconds. A rejected write showed an error and kept the copy icon. All three checks passed.
- Mobile typecheck, formatting, lint and knip passed.
- The iPhone check above covered the original behavior. I haven’t run the patched build on a device or simulator, so there are no native before/after captures attached.
Implemented with GPT-6.2 Astra using the Codex harness in T3 Code.
- 1
tanstack-source added labelsbug
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:S
Approvability#
Verdict: Approved at
b6ebb16Macroscope's review found this PR approvable — The mobile code-block copy button now briefly shows successful copying and reports clipboard failures. The change reuses the existing clipboard behavior and is confined to interaction feedback.
You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).No actionable comments were generated in the recent review.
Walkthrough
-
HighlightedCodeBlock now uses CopyTextButton for its header copy action. It passes the code, accessibility label, sizing, and theme-derived tint colors. The long-press copy menu remains unchanged.
Changes: Code block copy action
Layer / File(s) Summary Configure the copy button
apps/mobile/src/native/HighlightedCodeBlock.tsxThe header copy action now uses CopyTextButton with the code, accessibility label, sizing, and theme-derived tint colors. Estimated code review effort: 2 (Simple) | ~8 minutes
Change: Bug fix
Suggested reviewers:
chenxin-yan
Merge Risk:
Minimal · up tob6ebb-
The code block header now shows a checkmark and a "Copied" label after copying. The change is small and reuses an existing component. The author has not tested the patched build on a device, but no concrete defect is established.
Pre-merge checks:
4-
Check name Status Explanation Title check The title "fix(mobile): show when highlighted code has been copied" matches the main change. HighlightedCodeBlock now uses the existing CopyTextButton in its header, which shows a checkmark and a "Cop… Linked Issues check Check skipped because no linked issues were found for this pull request. Out of Scope Changes check Check skipped because no linked issues were found for this pull request. Description check The description covers the problem (the copy button gave no visible feedback on iPhone), the change (reusing CopyTextButton in the HighlightedCodeBlock header, with a checkmark and a "Copied" accessib… Full details: Title check
-
Explanation
The title "fix(mobile): show when highlighted code has been copied" matches the main change. HighlightedCodeBlock now uses the existing CopyTextButton in its header, which shows a checkmark and a "Copied" accessibility label for 1.2 seconds after a successful copy. The title is concise, uses a conventional commit prefix, and names the user-visible behavior.
Full details: Description check
-
Explanation
The description covers the problem (the copy button gave no visible feedback on iPhone), the change (reusing CopyTextButton in the HighlightedCodeBlock header, with a checkmark and a "Copied" accessibility label for 1.2 seconds), the scope (the HighlightedCodeBlock portion of
#43174, covering SQL and Kotlin blocks), and verification (mocked-clipboard component checks, and typecheck, format, lint and knip passing). It states what was not tested: no patched build on a device or simulator. Gaps against the template: the scope section does not state why the change needs no linked issue, since it refers to#43174but does not say whether that issue shows the bug or is a feature request. The template also asks for the model and harness used, and the author did name them (GPT-6.2 Astra with the Codex harness in T3 Code). The title is a conventional commit title in the objectives, but the PR description does not show a title. The screenshot is a component test image, not a before/after UI capture; the template asks for before/after screenshots for UI changes, and the author explains why none exist for the native build.
-
Finishing Touches
-
Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info-
Run configuration-
- Source mode: Auto
- Repository: pingdotgg/t3code
- Branch: main
- File: .coderabbit.config.ts
- Commit: 4b81999
- Layers: Repository TS config
- Review profile: CHILL
- Plan: Advanced
- Run ID:
df5a64e5-1892-4b2d-a9e1-a1cce75a9799
Commits-
Reviewing files that changed from the base of the PR and between 4b8199987cb63f82912b8f3dbe9de6a96cdb057b and b6ebb167b1859c5192ae1b552bca40e441ab2df9.
Files selected for processing: 1-
apps/mobile/src/native/HighlightedCodeBlock.tsx
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
-
-
Sign in to join this conversation.
macroscopeapp[bot](GitHub profile, opens in a new tab) approved these changes