Skip to content

Scroll a long iOS Worktree sheet instead of overflowing the screen - #1031

Merged
ivanfenenko merged 1 commit into
mainfrom
fix/worktree-sheet-scroll
Nov 11, 2026
Merged

ivanfenenko merged 1 commit into
mainfrom
fix/worktree-sheet-scroll

Conversation

@ivanfenenko

@ivanfenenko ivanfenenko commented Nov 11, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

On iOS, the New session Worktree sheet with many worktrees grew taller than the screen: the header went off the top, and the list could not scroll (a swipe dragged the card, which then sprang back).

Cause: a .fitAllContent bottom sheet measures its body before the overlay has a size and ignores that measure on purpose. Worktree rows have a fixed height, so the body never measures again, and the sheet never learns how tall its list is. It stays a compact card sized to its content instead of resting at its height limit and scrolling.

Fix: OpenCodeBottomSheet keeps the body's last measure and applies it once the overlay has a size, and again after a height policy change.

Checks

  • Reproduced the bug in the real app against a throwaway opencode v2 server, using a project with 40 git worktrees (iPhone 17 simulator, iOS 27.2).
  • With the fix, the sheet rests below the status bar with its header showing, scrolls to the last worktree, and still scrolls after closing and reopening.
  • Screenshots are in a comment below.

Risks / Follow-ups

  • iOS only. Android was not checked for the same overflow.
  • Unit tests were not run; the change is in the sheet view, not in the tested layout math.

🤖 Generated with Claude Code


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

A fit-all bottom sheet measured its body before the overlay had a size and
ignored that measure. Fixed-height rows never measured again, so a long
Worktree list stayed a compact card taller than the screen that could not
scroll. Keep the last body measure and apply it once the overlay has a size
(and after a height policy change).

The gallery Bottom Sheet gains a 40-item option for long fit-all lists.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@ivanfenenko

Copy link
Copy Markdown
Collaborator Author

iOS, New session → Worktree, project with 40 worktrees (throwaway server, sample data).

Before After
Worktree sheet taller than the screen, header off the top Worktree sheet resting below the status bar with header and scrollable list

@ivanfenenko
ivanfenenko merged commit 3c3c64b into main Nov 11, 2026
@ivanfenenko
ivanfenenko deleted the fix/worktree-sheet-scroll branch November 11, 2026 23:09

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Automated review: 1 finding(s) that 2+ of 3 passes agreed on.

Outside the diff lines:

  • ios/OpenCode Mobile/OpenCode Mobile/Components/Chrome/OpenCodeBottomSheet.swift:742 high: Reapplied zero-width body measure can permanently lock a short sheet into scrollable mode
2 finding(s) from a single pass, not posted
  • ios/OpenCode Mobile/OpenCode Mobile/Components/Chrome/OpenCodeBottomSheet.swift:709 medium: Stale zero-width measure is kept and later promotes short content (muse-spark-1.3-contributor)
  • ios/OpenCode Mobile/OpenCode Mobile/Components/Chrome/OpenCodeBottomSheet.swift:758 medium: Height-policy change restores content height but never re-evaluates mode (muse-spark-1.3-contributor)

opencode pr-review · passes: muse-spark-1.3-contributor, glm-5.3-flash, deepseek-v4.1-flash · $0.039 · 1 pass(es) stopped early

ivanfenenko added a commit that referenced this pull request Nov 11, 2026
…1032)

#1031 replayed the body measure taken before the overlay had a size. That
measure wraps text at no width and reads far too tall, so replaying it
could lock a short sheet to the scrollable detent; replaying after a height
change could also apply the previous page's height.

Report the body's size instead of its height. A body measured at no width
reports again once it has a width, even when single-line rows keep the same
height, so the long Worktree list still learns its real height without a
replay. Only measures with a width count, and the presentation mode waits
for a sized container.

Also drops the gallery's 40-item option from #1031; it never reproduced
the bug.

Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant