Skip to content

fix(keyboard): keep timeline pinned to bottom during iOS keyboard open/close#811

Closed
Just-Insane wants to merge 4 commits into
SableClient:devfrom
Just-Insane:fix/keyboard-scroll
Closed

fix(keyboard): keep timeline pinned to bottom during iOS keyboard open/close#811
Just-Insane wants to merge 4 commits into
SableClient:devfrom
Just-Insane:fix/keyboard-scroll

Conversation

@Just-Insane
Copy link
Copy Markdown
Contributor

@Just-Insane Just-Insane commented May 14, 2026

Superseded by #836 — consolidated with #810, #812, #813, #828, #829 into a single mobile/iOS/iPad PR.

When the thread drawer is open alongside the main room view, two
RoomInput components each mount their own useKeyboardHeight instance.
On keyboard open the thread instance had savedHeight=0 (freshly mounted),
so its immediate-estimate branch fell back to viewport.height — the
wrong mid-animation value — and overwrote the correct estimate already
written by the main room instance.  This produced a third layout change
(wrong height → correct height) visible as jank on every keyboard open.

Fix: promote savedHeight, cssVarsSet, and the mount reference counter to
module-level variables so all instances share them.

- sharedSavedHeight: all instances read and write the same value, so the
  estimate is always correct even for newly-mounted instances.
- cssVarsApplied: the 'only set once while keyboard open' guard now works
  across instances, preventing double setCSSVars calls.
- mountCount: reference-counted so only the last instance to unmount
  clears the CSS variables — prevents the thread drawer unmounting while
  the main room keyboard is still open from wiping --sable-visible-height.
…yboard open

- useKeyboardHeight: use previously-measured height as the initial estimate
  so the immediate setCSSVars call and the stability-timer call land on the
  same pixel value. This eliminates the second layout pass that caused visible
  stutter during the iOS keyboard slide-up animation.

- RoomTimeline ResizeObserver: record lastProgrammaticBottomPinAtRef before
  scrollTo when the viewport shrinks while at bottom. This keeps
  handleVListScroll inside the settle window so atBottom stays true and the
  'Jump to Present' button no longer flashes when the keyboard opens.
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