Skip to content

fix(mobile): stop Android desktop windows from clipping text - #8200

Open
mrmg wants to merge 5 commits into
pingdotgg:mainfrom
mrmg:fix/android-windowed-desktop-scaling
Open

mrmg wants to merge 5 commits into
pingdotgg:mainfrom
mrmg:fix/android-windowed-desktop-scaling

Conversation

@mrmg

@mrmg mrmg commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Problem

This is a bug fix for already-broken Android desktop windows, not a new desktop-window feature.

On Samsung DeX and Pixel Desktop, T3 Code Android renders with clipped, overlapping type. Split layout turns on (so the window size is seen), but glyphs paint at the phone's density inside the desktop window. The same build is fine on a Fold inner screen.

Both reports are the same failure:

Fix

React Native's DisplayMetricsHolder re-inits from the application context, so PixelUtil (text, layout, react-native-screens frames) keeps the phone density inside a desktop window. That is why JS useWindowDimensions() can turn on split layout while painted glyphs and screen frames are still wrong.

  • Unlock orientation for UI_MODE_TYPE_DESK as well as the 600dp tablet breakpoint (DeX / Pixel Desktop / ChromeOS, not just foldables).
  • After RN's config-change path, rebind DisplayMetricsHolder from the Activity and request a relayout so Yoga, type, and screen frames use window metrics. This is the [Bug]: Android Desktop UI extremely broken #8135 "content does not fill the window / settings is a tiny island" path, not only the sidebar title.
  • Size the Android "Threads" title so a 34px font has a line box that fits its row (includeFontPadding: false).

Native fingerprint change (MainActivity). Needs a store/preview binary, not an OTA.

Test plan

  • Unit tests for desk-mode orientation policy and MainActivity patch
  • Install the EAS preview APK on a Galaxy Z Fold (DeX) or Pixel Desktop and open T3 Code in a freeform window
  • Confirm sidebar/header type is legible, the chat pane fills the window, settings is not a tiny island, and resize keeps glyphs in their boxes
  • Confirm the window still pairs over Tailscale

Fixes #8195
Fixes #8135

Made with Grok.

Summary by CodeRabbit

  • New Features
    • Android tablets, foldables, and desktop-mode windows can rotate when appropriate, while phones and car-mode windows remain portrait-locked.
    • Improved Android window metrics and relayout behavior for more accurate sizing and text rendering.
    • Updated the Threads sidebar title with improved sizing, spacing, and accessibility semantics.
  • Bug Fixes
    • Removed excess Android font padding from branding and sidebar title text for more consistent alignment.

@coderabbitai

coderabbitai Bot commented Aug 25, 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: 7fc65b64-1fa7-42a3-991b-ac9e80f9961a

📥 Commits

Reviewing files that changed from the base of the PR and between 77bca8b and 590e685.

📒 Files selected for processing (7)
  • apps/mobile/plugins/withAndroidTabletOrientation.cjs
  • apps/mobile/src/components/CompactBrandTitle.tsx
  • apps/mobile/src/features/threads/ThreadNavigationSidebar.tsx
  • apps/mobile/src/lib/androidWindowing.test.ts
  • apps/mobile/src/lib/androidWindowing.ts
  • apps/mobile/src/lib/layoutMetrics.test.ts
  • apps/mobile/src/lib/layoutMetrics.ts

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


📝 Walkthrough

Walkthrough

The Android plugin now detects tablet and desktop window modes, reapplies window metrics, and migrates legacy injections. Android sidebar title metrics, accessibility properties, and font-padding behavior are also updated and tested.

Changes

Android windowing and layout

Layer / File(s) Summary
Desktop-aware orientation and metric rebinding
apps/mobile/src/lib/androidWindowing.ts, apps/mobile/plugins/withAndroidTabletOrientation.cjs, apps/mobile/src/lib/androidWindowing.test.ts
Orientation unlocks at the 600dp threshold or in desk mode. The plugin rebinds DisplayMetricsHolder, updates configuration handling, migrates legacy code, and uses an idempotent patch marker.
Android Threads title layout and typography
apps/mobile/src/lib/layoutMetrics.ts, apps/mobile/src/features/threads/ThreadNavigationSidebar.tsx, apps/mobile/src/components/CompactBrandTitle.tsx, apps/mobile/src/lib/layoutMetrics.test.ts
The Threads title uses Android-specific size, line height, minimum row height, heading semantics, and disabled font padding. Related title text also disables Android font padding. Tests validate the metrics and accessibility properties.

Priority: ⬆️ High

Estimated code review effort: 4 (Complex) | ~45 minutes

Change: Bug fix · Severity of issue fixed: High

Suggested reviewers: juliusmarminge

Merge Risk: ⚪ Minimal · up to 590e6

The Android desktop windowing and sidebar title changes preserve the covered platform behavior and accessibility contracts. No actionable merge-blocking risk remains.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description clearly explains the problem, fix, affected environments, test plan, and native binary requirement. However, it does not use the required What Changed, Why, UI Changes, and Checklist s… Rewrite the description using the repository template headings. Add clear before/after screenshots for the UI changes, complete the checklist, and update the device-validation results after testing on DeX or Pixel Desktop.
Docstring Coverage ⚠️ Warning Docstring coverage is 37.50% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 8 functions across 7 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main change: fixing clipped text in Android desktop windows.
Linked Issues check ✅ Passed The changes address the coding requirements in [#8195] and [#8135]. withAndroidTabletOrientation.cjs unlocks orientation for tablet-sized and desk-mode windows. It rebinds DisplayMetricsHolder fro…
Out of Scope Changes check ✅ Passed The changed files remain within the linked issue scope. The native plugin changes implement Android desktop and configuration-change handling. The layout metrics, sidebar title, and brand-title change…
Full details: Description check

Explanation

The description clearly explains the problem, fix, affected environments, test plan, and native binary requirement. However, it does not use the required What Changed, Why, UI Changes, and Checklist sections, and it lacks the required before/after screenshots for the UI changes. Device validation also remains incomplete.

  • 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.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:L 100-499 changed lines (additions + deletions). labels Aug 25, 2026
@mrmg

mrmg commented Aug 25, 2026

Copy link
Copy Markdown
Contributor Author

Before (Samsung DeX)

User-captured on Galaxy Z Fold 4 in a 1920×1080 DeX window. Split layout is on, but type is vertically clipped and overlapping.

Before: T3 Code in Samsung DeX with clipped overlapping text

After

Not captured yet. This change is a native MainActivity / density rebind; it cannot be screenshotted from this Linux host (no DeX, no Android emulator/adb, and the EAS preview APK has not been installed on the Fold). After the preview:dev APK is on the device, drop an after shot of the same Threads split view in a DeX window here.

@macroscopeapp

macroscopeapp Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Not approved

Macroscope's review found this PR not approvable — The PR combines a sidebar rendering fix with native Android orientation and display-metric changes that apply across Activity creation and window configuration transitions. The new desktop-window behavior is broader than a small isolated text adjustment and warrants human review.

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

Samsung DeX and Pixel Desktop keep the phone's display density inside a
freeform window, so React Native type clips and overlaps. Unlock
orientation for desk-mode windows, rebind DisplayMetrics from the
Activity, and give the Threads title a line box that actually fits.

Made with Grok.
@mrmg
mrmg force-pushed the fix/android-windowed-desktop-scaling branch from e6a3ff0 to c2be54f Compare August 25, 2026 13:03
@mrmg

mrmg commented Aug 25, 2026

Copy link
Copy Markdown
Contributor Author

Rebased onto upstream main to clear merge conflicts (ThreadNavigationSidebar.tsx and layoutMetrics.ts).

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Want fixes drafted automatically? Bugbot Autofix can create code changes for findings. A team admin can enable Autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit c2be54f. Configure here.

Comment thread apps/mobile/src/features/threads/ThreadNavigationSidebar.tsx Outdated
The 34/41 Threads heading constants only set container minHeight after
CompactBrandTitle landed on main. Restore the large-title Text so
fontSize, lineHeight, and includeFontPadding apply to the painted
Android split-view header.
Comment thread apps/mobile/src/features/threads/ThreadNavigationSidebar.tsx
mrmg and others added 3 commits August 25, 2026 14:24
The 34/41 Threads Text dropped CompactBrandTitle's accessible heading
role, aria-level, and T3 Code, Threads label. Restore those props so
TalkBack still finds a level-1 heading.
…ed-desktop-scaling

Keep Android includeFontPadding on CompactBrandTitle after the Uniwind className conversion.

Co-authored-by: Cursor <cursoragent@cursor.com>
@mrmg

mrmg commented Sep 13, 2026

Copy link
Copy Markdown
Contributor Author

Merged main and resolved the remaining conflict in CompactBrandTitle.tsx (kept Uniwind classNames, kept Android includeFontPadding: false).

This PR is a bug fix for existing DeX / Pixel Desktop rendering, not a new desktop-window feature. It now Fixes both #8195 (canonical, DeX) and #8135 (Pixel Desktop, closed as a duplicate of #8195). The DisplayMetricsHolder activity rebind is the global density correction those reports share: clipped/overlapping type, chat and settings not filling the window, and resize making it worse.

#8195 is still unlabeled (bug is missing; the closed duplicate has it). I cannot add labels on this repo.

Sowyu pushed a commit to Sowyu/t3pretzel that referenced this pull request Sep 15, 2026
Fixes reproduced on an Android emulator and from upstream reports.

Feed: Android stops drawing a text view past the GPU's maximum texture
height, so a long list rendered as one selectable Text lost its tail and
took seconds per frame to draw. Long lists now split into 40-item chunks.
Wide assistant markdown blocks keep a pinned width; the feed reserves
bottom padding.

Keyboard: the feed re-pins after keyboard transitions settle and when the
composer collapses; the back gesture collapses the composer; sticky
composers only follow the keyboard after a fresh show or real focus
(upstream pingdotgg#8212).

Terminal: hardware Enter no longer moves focus off the terminal; keyboards
that use deleteSurroundingText (FUTO) send Backspace; forward delete works.

Also: stream haptics no longer buzz every 320ms on Android and all haptics
use the system engine; thread settings apply on tap without Save; typed
pairing codes are normalized to the server format; non-git projects fall
back to the current checkout instead of a dead worktree default; user CA
certificates are trusted; Ctrl/Cmd+Enter sends from a hardware keyboard;
thread rename, project favicons in the filter, tablet sidebar toggle,
desktop-window density, route titles, Material You review colors, bottom
gesture-bar insets, and the composer placeholder clipping (upstream PRs
pingdotgg#11503, pingdotgg#11370, pingdotgg#11339, pingdotgg#8200, pingdotgg#8717, pingdotgg#11445, pingdotgg#6003, pingdotgg#5052, pingdotgg#8362, pingdotgg#10709,
pingdotgg#11611, pingdotgg#8800, adapted).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Android DeX / windowed desktop clips and overlaps UI text [Bug]: Android Desktop UI extremely broken

1 participant