Skip to content
Source
Sign inSign up
pingdotgg/t3code

[Bug]: iOS composer loses its scroll position and jumps to the first line when the keyboard hides or text is dictated #22006

Closedvdoshi96(GitHub profile, opens in a new tab) opened this issue 2 comments

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/mobile

Steps to reproduce

  1. Open a thread in the iOS app and tap the composer, so it expands and the keyboard opens.
  2. Dictate or type a long prompt, longer than the expanded editor can show (more than about 3 to 6 lines, depending on text size), so the editor scrolls.
  3. Scroll the editor to the middle or end of the draft and put the caret there.
  4. Dismiss the keyboard by tapping the conversation or swiping it down, then tap the composer again.
  5. Separately: with the caret at the end of a long draft, keep dictating or typing so the draft grows.

Expected behavior

  • The editor keeps its scroll position and the caret stays visible when the keyboard hides and comes back.
  • While text is inserted at the caret, by dictation or typing, the editor keeps the caret in view, so the newest text is visible.

Actual behavior

  • After the keyboard hides and reopens, the editor is scrolled back to the first line. The caret is often off-screen, so you have to scroll back through the whole draft to find your place.
  • While dictating into a long draft, the view often jumps back to the start rather than following the new text.
  • The jumps line up with the keyboard opening and closing. The scroll position seems tied to the composer expanding and collapsing.

Together these make a long dictated prompt very hard to read or review before sending.

Impact

Major degradation or frequent failure

Version or commit

TestFlight build current as of 2026-10-19; source checked on main at 48b486bd73

Environment

iPhone, iOS 27.2 developer beta, T3 Code iOS app (TestFlight) connected to T3 Code Nightly desktop

Likely cause (from reading the source)

  • The composer expands only while focused: isExpanded = isFocused || settingsSheetPresentation.keepsComposerExpanded (apps/mobile/src/features/threads/ThreadComposer.tsx:481).
  • Collapsing swaps the editor to height: 36 and scrollEnabled={false}. Expanding swaps back to minHeight: 72, maxHeight: 160 and scrollEnabled={true} (ThreadComposer.tsx:915-928).
  • Natively, setScrollEnabled only flips textView.isScrollEnabled (T3ComposerEditorView.swift:717). Nothing in the iOS editor saves or restores contentOffset, or calls scrollRangeToVisible for the selection after a resize or a value change. Turning scrolling off and resizing the UITextView resets its offset to the top. Re-expanding doesn't bring it back.
  • Dictated text is written to the draft programmatically, and the editor doesn't scroll to the caret afterward. So a growing draft can leave the visible part stuck elsewhere.
  • #21126: long-prompt editing is cramped and the keyboard dismisses and reopens. The maintainer reply there treats the editor's size, a fixed max height of about 3 to 6 visible lines, as a feature request for Ideas. This report is only about the scroll-position bug, which happens at any editor size.
  • #16462: dictation into the collapsed composer clips the transcript.
  • #20812 (draft): reworks when the composer is one row or a card.

Workaround

After reopening the keyboard, scroll the editor back down by hand, or tap near the end of the visible text and use the space-bar cursor drag to reach the end.

  1. Note

    Grok responding on behalf of Julius.

    Thanks for the detailed report. The code on main lines up with your reading.

    When the composer loses focus it collapses (apps/mobile/src/features/threads/ThreadComposer.tsx:481). It switches to a fixed 36pt height with scrolling turned off, and switches back to the taller, scrollable editor on focus (lines 915-928). On iOS, setScrollEnabled only flips isScrollEnabled (apps/mobile/modules/t3-composer-editor/ios/T3ComposerEditorView.swift:717-718). Nothing in the editor saves or restores contentOffset, or scrolls the selection into view afterward. When a value from JS is applied, the whole attributedText is replaced and the selection is restored (lines 859-864), but the scroll position isn't. That fits both the jump to the top after the keyboard comes back and the view losing the caret while the draft grows.

    The collapsing itself is intended, and the editor's size is the feature request already being discussed under #21126. Losing your place in the draft is a separate problem, so accepting this as a bug.

  2. juliusmarminge added labelsaccepted

  3. juliusmarminge added labelsbug

  4. juliusmarminge added labelsvia-triage

  5. juliusmarminge added labelsneeds more info

  6. juliusmarminge removed labelsneeds more info

  7. Already fixed by #23096, merged as efa5381246. Checked current main at 8d3b061121: the offset preservation, restoration after layout, and caret reveal remain present. The merged PR records iOS simulator before/after recordings for dismissing and reopening a long draft, plus mid-draft caret and programmatic insertion checks. No new runtime reproduction was run in this pass. Keeping this issue closed.

Sign in to join this conversation.