2
0
Fork 0

feat: split the mobile keyboard model by alternate screen #35

Merged
aleksei merged 1 commit from feat/alternate-screen-viewport into main 2026-11-04 23:28:32 +00:00
Owner

Read #{alternate_on} for the active pane from the existing list-windows call and expose it as Window.alternate.

On a coarse pointer, a normal-screen window (alternate = 0) now shrinks its page to visualViewport.height while the keyboard is open: the terminal resizes above the keyboard and terminal.scrollToBottom() keeps the prompt at the bottom, so the page is no longer taller than the visible area and Safari has nothing to scroll. It deliberately does not use position: fixed; WebKit mis-handles a focused field inside a fixed subtree when the keyboard opens. Alternate-screen TUIs (pi, nvim, lazygit) keep the existing Collie scroll model. The compact mode uses 150/100 px hysteresis on the visualViewport baseline.

A real iPhone check with a shell and with pi is still needed.

Read `#{alternate_on}` for the active pane from the existing `list-windows` call and expose it as `Window.alternate`. On a coarse pointer, a normal-screen window (`alternate = 0`) now shrinks its page to `visualViewport.height` while the keyboard is open: the terminal resizes above the keyboard and `terminal.scrollToBottom()` keeps the prompt at the bottom, so the page is no longer taller than the visible area and Safari has nothing to scroll. It deliberately does **not** use `position: fixed`; WebKit mis-handles a focused field inside a fixed subtree when the keyboard opens. Alternate-screen TUIs (`pi`, `nvim`, `lazygit`) keep the existing Collie scroll model. The compact mode uses 150/100 px hysteresis on the `visualViewport` baseline. A real iPhone check with a shell and with `pi` is still needed.
Author
Owner

Validated on a temporary instance with mobile Playwright emulation: /api/tree reports alternate=false for a zsh window and alternate=true for pi. With the fake visual viewport shrunk from 844 to 500 px, the shell WindowPage becomes position: fixed at height 500; the pi page stays in normal flow. Real iPhone validation is still needed for the keyboard animation and safe-area height.

Validated on a temporary instance with mobile Playwright emulation: `/api/tree` reports `alternate=false` for a zsh window and `alternate=true` for pi. With the fake visual viewport shrunk from 844 to 500 px, the shell WindowPage becomes `position: fixed` at height 500; the pi page stays in normal flow. Real iPhone validation is still needed for the keyboard animation and safe-area height.
Author
Owner

The first version used position: fixed; on iOS that made the keyboard open and immediately close. Replaced with a height-only compact layout (visualViewport.height, no fixed positioning) plus hysteresis. Mobile Playwright check: shell page becomes 500 px tall at a fake 500 px viewport, terminal 399 px, key bar ends at 500, body scroll stays 0; the pi page stays 844 px.

The first version used `position: fixed`; on iOS that made the keyboard open and immediately close. Replaced with a height-only compact layout (`visualViewport.height`, no fixed positioning) plus hysteresis. Mobile Playwright check: shell page becomes 500 px tall at a fake 500 px viewport, terminal 399 px, key bar ends at 500, body scroll stays 0; the pi page stays 844 px.
aleksei force-pushed feat/alternate-screen-viewport from f7a72707e4 to b3a93dba4f 2026-11-04 23:26:02 +00:00 Compare
aleksei deleted branch feat/alternate-screen-viewport 2026-11-04 23:28:32 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
zoo/mux-portal!35
No description provided.