[GH-ISSUE #5710] [Issue]: Prevent iOS keyboard focus from scrolling the entire app shell #3156

Closed
opened 2026-10-21 06:00:04 +07:00 by bsakaguchi · 10 comments
Owner

Originally created by @SpicyMarinara on GitHub (Aug 31, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/5710

Originally assigned to: @SpicyMarinara on GitHub.

Summary

On current staging, focusing a chat field or double-tapping a Roleplay message to edit can still pan the entire iPhone app shell. The top bar moves with the page, and the transcript may repeatedly resist downward scrolling until the keyboard settles.

Expected behavior

Only the chat transcript or active textarea should scroll. The fixed app shell and top bar must remain anchored throughout keyboard opening, editing, and dismissal.

Actual behavior

The software keyboard can move the document-level viewport. Marinara then moves its already fixed full-screen shell using the observed document scroll, producing the displaced shell visible in the reporter's screenshot. During the same settling period, attempts to move farther down the transcript can be counteracted.

Steps to reproduce

  1. Run the Docker staging image and open a sufficiently long Roleplay chat on an iPhone.
  2. Double-tap a message to enter edit mode, or focus the composer.
  3. Open the software keyboard and try to scroll farther down.
  4. Intermittently observe the transcript being pushed upward or the whole application, including the top bar, moving as one document.

Environment

  • Marinara Engine version: Current staging; exact build hash not provided in the follow-up
  • Install type: docker (staging image)
  • OS + version: iOS 18.7
  • Browser or app shell: Mozilla/5.0 (iPhone; CPU iPhone OS 18_7 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.6 Mobile/15E148 Safari/604.1

Logs, screenshots, or video

The original iPhone screenshot and behavior description are recorded in #5672, #5685, and the maintainer report. The reporter has now confirmed the behavior still occurs on staging after those fixes.

Additional context

Follow-up to #4260 and #5672. Current code inspection found a direct feedback path: both chat composers call scrollIntoView() on focus, which may pan the iOS document, while AppShell reads window.scrollY and applies it as a transform to the fixed full-screen shell. Mobile CSS hides overflow but does not fix and size the document root itself.

Keep the correction narrow: lock the mobile document/root dimensions, skip document-scrolling focus assistance on iOS while retaining the Android path, and remove the full-shell scroll compensation transform. Add a regression that attempts document scrolling during simulated keyboard geometry and verifies only the transcript remains scrollable.

Implementation owner: @SpicyMarinara with Codex.

Template check

Please uncheck (untick) the box below before submitting so we know you read the template. It is intentionally pre-checked:

  • I DID NOT read this template and provide the requested details.
Originally created by @SpicyMarinara on GitHub (Aug 31, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/5710 Originally assigned to: @SpicyMarinara on GitHub. ## Summary On current `staging`, focusing a chat field or double-tapping a Roleplay message to edit can still pan the entire iPhone app shell. The top bar moves with the page, and the transcript may repeatedly resist downward scrolling until the keyboard settles. ## Expected behavior Only the chat transcript or active textarea should scroll. The fixed app shell and top bar must remain anchored throughout keyboard opening, editing, and dismissal. ## Actual behavior The software keyboard can move the document-level viewport. Marinara then moves its already fixed full-screen shell using the observed document scroll, producing the displaced shell visible in the reporter's screenshot. During the same settling period, attempts to move farther down the transcript can be counteracted. ## Steps to reproduce 1. Run the Docker `staging` image and open a sufficiently long Roleplay chat on an iPhone. 2. Double-tap a message to enter edit mode, or focus the composer. 3. Open the software keyboard and try to scroll farther down. 4. Intermittently observe the transcript being pushed upward or the whole application, including the top bar, moving as one document. ## Environment - Marinara Engine version: Current staging; exact build hash not provided in the follow-up - Install type: docker (`staging` image) - OS + version: iOS 18.7 - Browser or app shell: Mozilla/5.0 (iPhone; CPU iPhone OS 18_7 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.6 Mobile/15E148 Safari/604.1 ## Logs, screenshots, or video The original iPhone screenshot and behavior description are recorded in #5672, #5685, and the maintainer report. The reporter has now confirmed the behavior still occurs on staging after those fixes. ## Additional context Follow-up to #4260 and #5672. Current code inspection found a direct feedback path: both chat composers call `scrollIntoView()` on focus, which may pan the iOS document, while `AppShell` reads `window.scrollY` and applies it as a transform to the fixed full-screen shell. Mobile CSS hides overflow but does not fix and size the document root itself. Keep the correction narrow: lock the mobile document/root dimensions, skip document-scrolling focus assistance on iOS while retaining the Android path, and remove the full-shell scroll compensation transform. Add a regression that attempts document scrolling during simulated keyboard geometry and verifies only the transcript remains scrollable. Implementation owner: @SpicyMarinara with Codex. ## Template check Please **uncheck (untick)** the box below before submitting so we know you read the template. It is intentionally pre-checked: - [x] I DID NOT read this template and provide the requested details.
Author
Owner

@SpicyMarinara commented on GitHub (Aug 31, 2026):

Owned by @SpicyMarinara with Codex. Implementation is underway in draft PR #5712 against staging; the fix is scoped to the iOS document-scroll feedback loop while preserving Android keyboard handling.

<!-- gh-comment-id:5485562799 --> @SpicyMarinara commented on GitHub (Aug 31, 2026): Owned by @SpicyMarinara with Codex. Implementation is underway in draft PR #5712 against staging; the fix is scoped to the iOS document-scroll feedback loop while preserving Android keyboard handling.
Author
Owner

@SpicyMarinara commented on GitHub (Sep 1, 2026):

Reopened after a fresh physical-iPhone report in Roleplay mode: tapping the composer can move the visible viewport completely below the app, leaving only the dark document backing visible above the keyboard. The chat can be recovered by manually scrolling upward, but focus must not move the app out of view.

This is the same focus-driven app-shell displacement tracked here, so it belongs on the existing issue rather than a duplicate. Current code inspection points to the mobile document lock added in #5712: the app shell is fixed inside a newly fixed body, while iOS may still pan its visual viewport to reveal the focused textarea.

Implementation owner: @SpicyMarinara with Codex, using branch fix/5710-ios-roleplay-focus-empty-page. The fix will stay narrow and include an iPhone-sized WebKit regression for the visible shell geometry.

<!-- gh-comment-id:5496190722 --> @SpicyMarinara commented on GitHub (Sep 1, 2026): Reopened after a fresh physical-iPhone report in Roleplay mode: tapping the composer can move the visible viewport completely below the app, leaving only the dark document backing visible above the keyboard. The chat can be recovered by manually scrolling upward, but focus must not move the app out of view. This is the same focus-driven app-shell displacement tracked here, so it belongs on the existing issue rather than a duplicate. Current code inspection points to the mobile document lock added in #5712: the app shell is fixed inside a newly fixed `body`, while iOS may still pan its visual viewport to reveal the focused textarea. Implementation owner: @SpicyMarinara with Codex, using branch `fix/5710-ios-roleplay-focus-empty-page`. The fix will stay narrow and include an iPhone-sized WebKit regression for the visible shell geometry.
Author
Owner

@SpicyMarinara commented on GitHub (Sep 1, 2026):

Physical-iPhone verification on the latest staging build confirms #5732 did not resolve the displacement. The prior regression only varied visualViewport.offsetTop and missed the iOS document pan where pageTop can exceed offsetTop. @SpicyMarinara with Codex is continuing on branch fix/5710-ios-visual-viewport-page-top; the follow-up will model that exact divergence before changing the shell.

<!-- gh-comment-id:5497327851 --> @SpicyMarinara commented on GitHub (Sep 1, 2026): Physical-iPhone verification on the latest staging build confirms #5732 did not resolve the displacement. The prior regression only varied visualViewport.offsetTop and missed the iOS document pan where pageTop can exceed offsetTop. @SpicyMarinara with Codex is continuing on branch `fix/5710-ios-visual-viewport-page-top`; the follow-up will model that exact divergence before changing the shell.
Author
Owner

@SpicyMarinara commented on GitHub (Sep 1, 2026):

A new physical-iPhone report confirms the blank-screen displacement still occurs on the latest staging build after #5733. The attached before/after screenshots show Roleplay correctly anchored before focus, then the entire chat shell disappearing into the dark document backing while the keyboard remains open.

This matches the still-open WebKit keyboard-pan behavior: the document can be visually panned even when its scroll offsets remain zero, and fixed positioning is unreliable during that pan. Staging currently combines a fixed chat shell with an absolute visual-viewport top, which can apply the pan twice on the affected iPhone path.

Implementation owner: @SpicyMarinara with Codex, continuing on branch fix/5710-ios-absolute-chat-shell. The follow-up is limited to using document-coordinate positioning for the iOS chat shell while preserving the existing visual-viewport height and Android path, with a regression that models the native body pan.

<!-- gh-comment-id:5501202101 --> @SpicyMarinara commented on GitHub (Sep 1, 2026): A new physical-iPhone report confirms the blank-screen displacement still occurs on the latest staging build after #5733. The attached before/after screenshots show Roleplay correctly anchored before focus, then the entire chat shell disappearing into the dark document backing while the keyboard remains open. This matches the still-open WebKit keyboard-pan behavior: the document can be visually panned even when its scroll offsets remain zero, and fixed positioning is unreliable during that pan. Staging currently combines a fixed chat shell with an absolute visual-viewport top, which can apply the pan twice on the affected iPhone path. Implementation owner: @SpicyMarinara with Codex, continuing on branch `fix/5710-ios-absolute-chat-shell`. The follow-up is limited to using document-coordinate positioning for the iOS chat shell while preserving the existing visual-viewport height and Android path, with a regression that models the native body pan.
Author
Owner

@SpicyMarinara commented on GitHub (Sep 2, 2026):

A fresh physical-iPhone report confirms the blank Roleplay viewport still occurs on the latest staging build after #5739. The previous regression modeled only the case where WebKit shifts the fixed body by -visualViewport.pageTop; it did not cover the reported coordinate space where pageTop changes while the fixed body remains visually anchored. In that case staging applies pageTop anyway and pushes the entire shell below the keyboard viewport.

Implementation owner: @SpicyMarinara with Codex, continuing on branch fix/5710-ios-fixed-body-coordinate-space. The follow-up will derive compensation from the body displacement WebKit actually renders, with regressions for both anchored-body and shifted-body behavior.

<!-- gh-comment-id:5514339641 --> @SpicyMarinara commented on GitHub (Sep 2, 2026): A fresh physical-iPhone report confirms the blank Roleplay viewport still occurs on the latest staging build after #5739. The previous regression modeled only the case where WebKit shifts the fixed body by `-visualViewport.pageTop`; it did not cover the reported coordinate space where `pageTop` changes while the fixed body remains visually anchored. In that case staging applies `pageTop` anyway and pushes the entire shell below the keyboard viewport. Implementation owner: @SpicyMarinara with Codex, continuing on branch `fix/5710-ios-fixed-body-coordinate-space`. The follow-up will derive compensation from the body displacement WebKit actually renders, with regressions for both anchored-body and shifted-body behavior.
Author
Owner

@SpicyMarinara commented on GitHub (Sep 2, 2026):

Landed on staging via #5782 at merge commit d76f8acec. The published multi-architecture Docker :staging manifest is sha256:27db1ef84e6f098b01bd4a468e24763936e73de26a650bce67a720ae3a701398.

The regression now covers both iOS behaviors: visualViewport.pageTop changing while the fixed body remains anchored, and a genuinely shifted body that needs counter-positioning. Please pull/recreate the staging container and physically verify composer focus, typing, transcript scrolling, and keyboard dismissal on the affected iPhone.

<!-- gh-comment-id:5514668101 --> @SpicyMarinara commented on GitHub (Sep 2, 2026): Landed on `staging` via #5782 at merge commit `d76f8acec`. The published multi-architecture Docker `:staging` manifest is `sha256:27db1ef84e6f098b01bd4a468e24763936e73de26a650bce67a720ae3a701398`. The regression now covers both iOS behaviors: `visualViewport.pageTop` changing while the fixed body remains anchored, and a genuinely shifted body that needs counter-positioning. Please pull/recreate the staging container and physically verify composer focus, typing, transcript scrolling, and keyboard dismissal on the affected iPhone.
Author
Owner

@SpicyMarinara commented on GitHub (Sep 2, 2026):

A new physical-iPhone report reproduces the issue on current staging after #5782 and adds the same failure in the shared Create Character/Create Persona forms. That broader reproduction exposes the remaining root cause: the iOS chat shell and body-portal modals are still descendants of a fixed-position body, so WebKit can pan their common containing block when a focused control opens the keyboard. The previous patch compensated one observed Roleplay displacement but did not remove that shared fixed ancestor.

Implementation owner: @SpicyMarinara with Codex on branch fix/5710-ios-shared-keyboard-viewport. I am replacing the iOS-only fixed body containment with a document-coordinate visual-viewport shell shared by AppShell and Modal, while leaving the Android/non-iOS path unchanged. Regression coverage will exercise both the Roleplay composer and an auto-focused Create Persona field.

<!-- gh-comment-id:5516987299 --> @SpicyMarinara commented on GitHub (Sep 2, 2026): A new physical-iPhone report reproduces the issue on current staging after #5782 and adds the same failure in the shared Create Character/Create Persona forms. That broader reproduction exposes the remaining root cause: the iOS chat shell and body-portal modals are still descendants of a fixed-position body, so WebKit can pan their common containing block when a focused control opens the keyboard. The previous patch compensated one observed Roleplay displacement but did not remove that shared fixed ancestor. Implementation owner: @SpicyMarinara with Codex on branch `fix/5710-ios-shared-keyboard-viewport`. I am replacing the iOS-only fixed body containment with a document-coordinate visual-viewport shell shared by AppShell and Modal, while leaving the Android/non-iOS path unchanged. Regression coverage will exercise both the Roleplay composer and an auto-focused Create Persona field.
Author
Owner

@SpicyMarinara commented on GitHub (Sep 2, 2026):

Landed on staging via #5791 at merge commit 15627d45bda80c5bbac17ee83cfd1b129c76f73b. The published multi-architecture Docker :staging manifest is sha256:f3647d96f2dc42f380bcd5a109e19f9a9cf747dcd1372e4dc04165148e3a4cc5.

This follow-up removes the remaining iOS fixed-body ancestor and gives both AppShell and shared Modal portals the same document-coordinate VisualViewport geometry. The regression now covers the Roleplay composer plus the auto-focused Create Persona field (the same Modal path used by Create Character). All required PR checks, CodeRabbit, container validation, and the rerun WebKit matrix passed.

Please pull/recreate the staging container and physically verify Roleplay typing plus Create Character/Create Persona focus on the affected iPhone.

<!-- gh-comment-id:5517409773 --> @SpicyMarinara commented on GitHub (Sep 2, 2026): Landed on `staging` via #5791 at merge commit `15627d45bda80c5bbac17ee83cfd1b129c76f73b`. The published multi-architecture Docker `:staging` manifest is `sha256:f3647d96f2dc42f380bcd5a109e19f9a9cf747dcd1372e4dc04165148e3a4cc5`. This follow-up removes the remaining iOS fixed-body ancestor and gives both AppShell and shared Modal portals the same document-coordinate VisualViewport geometry. The regression now covers the Roleplay composer plus the auto-focused Create Persona field (the same Modal path used by Create Character). All required PR checks, CodeRabbit, container validation, and the rerun WebKit matrix passed. Please pull/recreate the staging container and physically verify Roleplay typing plus Create Character/Create Persona focus on the affected iPhone.
Author
Owner

@SpicyMarinara commented on GitHub (Sep 3, 2026):

Physical-iPhone verification on the latest staging build now isolates the remaining failure to repeated focus: the first Roleplay composer tap behaves correctly, but after dismissing the keyboard, every later tap displaces the app shell again. The current regression only covers a single keyboard-open cycle. Code inspection shows the offset clamp uses the current window.innerHeight; WebKit can make that value match the shrunken visual viewport on later keyboard cycles, which collapses the allowed document-coordinate offset to zero even though visualViewport.pageTop is still displaced.\n\nImplementation owner: @SpicyMarinara with Codex on branch fix/5710-ios-repeat-keyboard-focus. The follow-up will first reproduce open → dismiss → reopen with a resized layout viewport, then keep the pre-keyboard viewport baseline for the clamp without changing the non-iOS layout path.

<!-- gh-comment-id:5523047594 --> @SpicyMarinara commented on GitHub (Sep 3, 2026): Physical-iPhone verification on the latest staging build now isolates the remaining failure to repeated focus: the first Roleplay composer tap behaves correctly, but after dismissing the keyboard, every later tap displaces the app shell again. The current regression only covers a single keyboard-open cycle. Code inspection shows the offset clamp uses the current `window.innerHeight`; WebKit can make that value match the shrunken visual viewport on later keyboard cycles, which collapses the allowed document-coordinate offset to zero even though `visualViewport.pageTop` is still displaced.\n\nImplementation owner: @SpicyMarinara with Codex on branch `fix/5710-ios-repeat-keyboard-focus`. The follow-up will first reproduce open → dismiss → reopen with a resized layout viewport, then keep the pre-keyboard viewport baseline for the clamp without changing the non-iOS layout path.
Author
Owner

@SpicyMarinara commented on GitHub (Sep 3, 2026):

Landed the repeated-focus fix on staging via #5816 at merge commit 6aa81cb02e53593fa1adc0291f49893264754714. The published multi-architecture Docker :staging manifest is sha256:0d6ed012e12c1059a89e2e8baed94f664b8ae52be53c80702a7db0d9a382a983, and its arm64 image is labeled with that exact merge commit.\n\nThe regression now covers keyboard open → dismiss → reopen while WebKit reports window.innerHeight as the shrunken visual viewport. The iOS shell retains the full-height baseline for its offset clamp, while Android and desktop keep their previous calculation. All required PR checks, every hosted WebKit/Chromium shard, CodeRabbit review, and container validation completed successfully.\n\nPlease pull/recreate the staging container and verify at least three Roleplay composer focus cycles on the affected iPhone. Create Character/Create Persona share the same shell viewport contract and should also remain anchored across repeated keyboard cycles.

<!-- gh-comment-id:5523617861 --> @SpicyMarinara commented on GitHub (Sep 3, 2026): Landed the repeated-focus fix on `staging` via #5816 at merge commit `6aa81cb02e53593fa1adc0291f49893264754714`. The published multi-architecture Docker `:staging` manifest is `sha256:0d6ed012e12c1059a89e2e8baed94f664b8ae52be53c80702a7db0d9a382a983`, and its arm64 image is labeled with that exact merge commit.\n\nThe regression now covers keyboard open → dismiss → reopen while WebKit reports `window.innerHeight` as the shrunken visual viewport. The iOS shell retains the full-height baseline for its offset clamp, while Android and desktop keep their previous calculation. All required PR checks, every hosted WebKit/Chromium shard, CodeRabbit review, and container validation completed successfully.\n\nPlease pull/recreate the staging container and verify at least three Roleplay composer focus cycles on the affected iPhone. Create Character/Create Persona share the same shell viewport contract and should also remain anchored across repeated keyboard cycles.
Sign in to join this conversation.
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
Pasta-Devs/Marinara-Engine#3156
No description provided.