Skip to content

fix(mobile): keep Android file icons on the line with wrapped filenames - #11234

Open
SunkenInTime wants to merge 1 commit into
pingdotgg:mainfrom
SunkenInTime:t3code/fix-android-icon-wrap
Open

fix(mobile): keep Android file icons on the line with wrapped filenames#11234
SunkenInTime wants to merge 1 commit into
pingdotgg:mainfrom
SunkenInTime:t3code/fix-android-icon-wrap

Conversation

@SunkenInTime

@SunkenInTime SunkenInTime commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

What Changed

On Android, a file or link icon can stay on the previous line when its filename wraps. #11118 fixed the vertical icon drift and explicitly left this wrapping issue out of scope ("An icon can still stay on the previous line when its filename wraps").

Android renders the icon as an inline Image before the label, and the regular space between them is a line-break opportunity. This prefixes the label with a non-breaking space on Android so the icon and its label wrap together. The native copy sanitizer strips that spacer alongside the image placeholder, including when the selection starts after the icon, so copied text matches what was authored.

This is the wrapping half of #11079 (reverted in #11098). The drift half is intentionally not re-added, since #11118 solved it natively. The renderer files are shared between platforms (#11128); the new branch only runs on Android and the iOS text path is untouched.

Why

The NBSP is the smallest change that ties the icon to its label in a single TextView run without changing layout for any other text.

Verification

  • nativeMarkdownText.test.ts: 35 passed
  • Mobile typecheck and lint on the changed file: clean
  • Robolectric MarkdownSelectionCopyTest (4 tests) via :t3tools-mobile-markdown-text:testDebugUnitTest: all pass
  • Native sanitizer change needs a new Android binary; an older installed build keeps the previous copy behavior.

UI Changes

Same seeded message on a Pixel 9 Pro API 36 emulator. The "before" runs the upstream main renderer on a binary that already includes #11118, so drift is out of the picture and only wrapping differs. Four of the ten bullets strand their icon at the end of a line before the change.

Android before Android after
Android before: file icons stranded at line ends with filenames on the next line Android after: every icon wraps together with its filename

iOS with this branch's bundle, iPhone 17 simulator. The Android-only branch does not run here and inline icons render as before:

iOS: inline file icons unchanged

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for any UI changes
  • I included a video for animation/interaction changes. Not applicable; static layout.

Model: Claude Fable 5.1. Harness: Claude Code in T3 Code.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Improved Android text wrapping so file and external-link icons remain attached to their associated text.
    • Updated text selection and copying to exclude inline image placeholders and automatically inserted spacing, while preserving authored whitespace and literal characters.
    • Copying text without inline images now behaves consistently when selections begin immediately after an icon or when no inline images are present.

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:L 100-499 changed lines (additions + deletions). labels Sep 11, 2026
Android renders file and link icons as an inline Image before the label.
The regular space between them is a line-break opportunity, so a long
filename could wrap while its icon stayed on the previous line. Prefix
the label with a non-breaking space on Android so the icon and its label
wrap together. The native copy sanitizer strips that spacer alongside the
image placeholder so selected text matches what was authored.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@SunkenInTime
SunkenInTime force-pushed the t3code/fix-android-icon-wrap branch from bf0907e to 788603c Compare September 11, 2026 12:42
@github-actions github-actions Bot added size:M 30-99 changed lines (additions + deletions). and removed size:L 100-499 changed lines (additions + deletions). labels Sep 11, 2026
@SunkenInTime
SunkenInTime marked this pull request as ready for review September 11, 2026 13:00
@cursor

cursor Bot commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

Bugbot is paused — on-demand spend limit reached

Bugbot uses usage-based billing for this team and has hit its on-demand spend limit.

A team admin can raise the spend limit in the Cursor dashboard, or wait for the next billing cycle to continue.

@macroscopeapp

macroscopeapp Bot commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at 788603c

Macroscope's review found this PR approvable — This is a narrowly scoped Android rendering and copy-behavior bug fix. The production changes are platform-gated and limited to icon-bearing markdown runs, with focused native tests and no schema, deployment, security, billing, or default-setting impact.

You can add or adjust custom eligibility rules. Learn more.

@coderabbitai

coderabbitai Bot commented Sep 11, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: be6e9b3a-14fb-4446-8546-4cb962690b6d

📥 Commits

Reviewing files that changed from the base of the PR and between 211618f and 788603c.

📒 Files selected for processing (4)
  • apps/mobile/modules/t3-markdown-text/android/build.gradle
  • apps/mobile/modules/t3-markdown-text/android/src/main/java/expo/modules/t3markdowntext/T3MarkdownTextSelectionModule.kt
  • apps/mobile/modules/t3-markdown-text/android/src/test/java/expo/modules/t3markdowntext/MarkdownSelectionCopyTest.kt
  • apps/mobile/modules/t3-markdown-text/src/NativeMarkdownSelectableText.tsx

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

Android icon runs now use non-breaking-space prefixes. Selection copying removes inline image placeholders and injected spacers. Robolectric tests cover whitespace, selection offsets, literal object characters, and text without image spans.

Changes

Inline image rendering and selection copy

Layer / File(s) Summary
Icon spacer rendering
apps/mobile/modules/t3-markdown-text/src/NativeMarkdownSelectableText.tsx
Android file and link icon runs now prefix their text with a non-breaking space.
Selection copy filtering and tests
apps/mobile/modules/t3-markdown-text/android/src/main/java/.../T3MarkdownTextSelectionModule.kt, apps/mobile/modules/t3-markdown-text/android/src/test/java/.../MarkdownSelectionCopyTest.kt, apps/mobile/modules/t3-markdown-text/android/build.gradle
The copy helper removes inline image placeholders and following spacers. Robolectric and Java 21 test configuration was added. Tests cover selection offsets and whitespace preservation.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: juliusmarminge

Merge Risk: ⚪ Minimal · up to 78860

Android wrapped icon labels and copied text are covered by the corresponding rendering and selection behavior, with no actionable merge risk identified.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 9 functions across 3 files. (1 skipped: 1 … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description check ✅ Passed The description includes the required What Changed, Why, UI Changes, and Checklist sections. It clearly explains the Android-only behavior, the copy-sanitizer update, verification results, screenshots…
Title check ✅ Passed The title is concise and accurately identifies the main change: keeping Android file icons with wrapped filenames.
Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 9 functions across 3 files. (1 skipped: 1 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M 30-99 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant