[PR #7021] [MERGED] fix(chat): keep edited text pressable and reachable above the phone keyboard #7432

Closed
opened 2026-10-23 04:19:44 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/7021
Author: @SpicyMarinara
Created: 10/3/2026
Status: ✅ Merged
Merged: 10/3/2026
Merged by: @SpicyMarinara

Base: staging ← Head: fix/mobile-ime-focus-6992


📝 Commits (6)

  • cebc520 fix(roleplay): keep phone message editing clear of the top bar and iPhone keyboard
  • b2ab2f3 Merge remote-tracking branch 'origin/staging' into fix/mobile-ime-focus-6992
  • 90d15db fix(chat): keep edited text pressable under iPad top controls and the Conversation header
  • 710bf72 fix(conversation): keep an edited message's first line below the header when the keyboard opens
  • 22ac3b4 Merge remote-tracking branch 'origin/staging' into fix/mobile-ime-focus-6992
  • 9a9ea9a fix(chat): scroll an edited message back when it starts under the top controls

📊 Changes

7 files changed (+389 additions, -20 deletions)

View changed files

📝 CHANGELOG.md (+2 -0)
📝 e2e/ipad-touch.e2e.ts (+27 -5)
➕ e2e/roleplay-mobile-editing.e2e.ts (+303 -0)
📝 packages/client/src/components/chat/ChatMessage.tsx (+29 -3)
📝 packages/client/src/components/chat/ChatRoleplaySurface.tsx (+13 -5)
📝 packages/client/src/components/chat/ConversationView.tsx (+9 -5)
📝 packages/client/src/hooks/use-visual-viewport-chat-bottom.ts (+6 -2)

📄 Description

Important

Contributions target staging. Only SpicyMarinara may promote this repository's staging branch or a same-repository hotfix/* branch to main.
Outside and first-time contributors also require an approving review from SpicyMarinara.

Linked issue

Closes #6992

Why this change

#6992 reports three things on phones:

  1. Gboard's language menu closes as soon as it opens. This comes from Chrome 154 for Android, not from Marinara. Chromium change Ief7ab82699ece79d836d187172a575ff28c001dc ("force text input state update upon window focus changed") hides the soft keyboard when the window loses focus. It was cherry-picked to M154 and is absent in M153. Gboard's menu is a focusable window, so opening it hides the keyboard and the menu with it, on every website. Testing Marinara on staging showed it never moves focus, the caret or the field when keyboard UI blurs the window, resizes the viewport or composes text. A guard test now keeps it that way.
  2. Text along the top edge can't be selected while editing. This one is ours. On phones, the transparent Roleplay top strip swallowed touches across its full width, and editing put the message's first line under it. That alignment shipped in 2.4.6 (#5851).
  3. On iPhone, the end of a long edited message can't be reached. The editor was taller than the space above the keyboard, because iOS doesn't shrink dvh for it.

What changed

  • Roleplay, phones: editing now starts below the top buttons. While you edit, the strip around them lets taps through except on the buttons themselves.
  • Conversation, phones: the see-through header lets touches through except on its card, menu buttons and package controls. Opening the keyboard while editing keeps the first line below the header (scroll-pt-16).
  • iPad: opening the keyboard while editing a long Roleplay message brings its first line back below the top controls, using the transcript's scroll padding.
  • iPhone: a long edited message fits above the keyboard together with its Save button.
  • Tests: e2e/roleplay-mobile-editing.e2e.ts is new, and e2e/ipad-touch.e2e.ts is extended. They cover:
    • first-line touches in Roleplay and Conversation;
    • the iPhone fit with Save;
    • iPad short and long replies;
    • a guard that keyboard pop-ups leave the focused field, its caret and its text alone.
  • CHANGELOG: one entry.

Validation

  • pnpm check passes locally
  • Container (Docker / Podman) built and ran without issue
  • Ran the app, clicked through the changes manually
  • Checked edge cases (light + dark mode, mobile viewport, empty states, error paths)
  • Above manual verification completed (describe below)
  • Read and followed CONTRIBUTING.md

Manual verification notes

Run by the agent:

  • pnpm check, pnpm localization:check and pnpm smoke:ui (desktop) pass.
  • The mobile Playwright sets pass on mobile-chromium, mobile-webkit and iPad: roleplay-mobile-editing, ipad-touch, and the related core-flows, client-runtime-diagnostics, author-notes and chat-lorebook-entry-scope cases. Device-specific skips are by design.
  • Each fix was reverted on its own, and its test then fails. Each fix restored passes.
  • Two adversarial reviews ran. Their findings were fixed: the iPad first line, the Conversation header, the Conversation keyboard edit, and the CHANGELOG wording.
  • One unrelated flake: "mobile transcript swipes navigate Conversation and Roleplay alternatives" failed once on mobile-chromium, then passed 3/3 alone. It sends synthetic touches, with no scrolling involved.

Still to verify by hand:

  • On an Android phone with Chrome 154, focus a text field on any website (not Marinara) and long-press Gboard's spacebar. The Change keyboard menu closes there too, which confirms Chrome is the cause.
  • On a real iPhone (Safari and the installed app), edit a long Roleplay message. Scrolling inside the editor reaches the last lines above the keyboard, and Save can be tapped.
  • On an Android phone, edit a Roleplay message and long-press words on its first line, including near the right edge. They select.
  • On an iPad, edit a long Roleplay message with agents on and open the keyboard. The first line sits below the top controls and can be pressed. Also try it in a Conversation chat, which no test covers.
  • In a Conversation chat on a phone, edit the latest long reply and open the keyboard. The first line sits below the header, and the header's buttons still work.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed
  • Translated docs on the docs-i18n branch updated to match, or a [docs-i18n] follow-up issue opened (see CONTRIBUTING.md § Translated documentation)
  • Version/release files updated (only if this PR includes a version bump)

CHANGELOG updated; no user docs change.

Summary by CodeRabbit

  • Bug Fixes
    • Improved mobile message editing so the editor and Save button remain accessible above the on-screen keyboard, including for long replies.
    • Improved touch targeting around chat controls and headers, and adjusted scrolling to keep edited messages visible.
    • Preserved editor and composer focus, cursor position, and text during mobile keyboard and viewport changes.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/7021 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 10/3/2026 **Status:** ✅ Merged **Merged:** 10/3/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `fix/mobile-ime-focus-6992` --- ### 📝 Commits (6) - [`cebc520`](https://github.com/Pasta-Devs/Marinara-Engine/commit/cebc5201520ec00666a2fe01197c314a1283a54e) fix(roleplay): keep phone message editing clear of the top bar and iPhone keyboard - [`b2ab2f3`](https://github.com/Pasta-Devs/Marinara-Engine/commit/b2ab2f35095e1ace07eef6dfd194197bdf6cd552) Merge remote-tracking branch 'origin/staging' into fix/mobile-ime-focus-6992 - [`90d15db`](https://github.com/Pasta-Devs/Marinara-Engine/commit/90d15db832a3c479b30d4fa0a7c72af8bbaca09f) fix(chat): keep edited text pressable under iPad top controls and the Conversation header - [`710bf72`](https://github.com/Pasta-Devs/Marinara-Engine/commit/710bf72c4fc550fb9e69fc7c9a53c079371f43e8) fix(conversation): keep an edited message's first line below the header when the keyboard opens - [`22ac3b4`](https://github.com/Pasta-Devs/Marinara-Engine/commit/22ac3b416f0c5e2a1b686da3bd62d17e13604c9d) Merge remote-tracking branch 'origin/staging' into fix/mobile-ime-focus-6992 - [`9a9ea9a`](https://github.com/Pasta-Devs/Marinara-Engine/commit/9a9ea9ae4dd4c6bff1e2001d66e328a82193f224) fix(chat): scroll an edited message back when it starts under the top controls ### 📊 Changes **7 files changed** (+389 additions, -20 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+2 -0) 📝 `e2e/ipad-touch.e2e.ts` (+27 -5) ➕ `e2e/roleplay-mobile-editing.e2e.ts` (+303 -0) 📝 `packages/client/src/components/chat/ChatMessage.tsx` (+29 -3) 📝 `packages/client/src/components/chat/ChatRoleplaySurface.tsx` (+13 -5) 📝 `packages/client/src/components/chat/ConversationView.tsx` (+9 -5) 📝 `packages/client/src/hooks/use-visual-viewport-chat-bottom.ts` (+6 -2) </details> ### 📄 Description > [!IMPORTANT] > Contributions target `staging`. Only `SpicyMarinara` may promote this repository's `staging` branch or a same-repository `hotfix/*` branch to `main`. > Outside and first-time contributors also require an approving review from `SpicyMarinara`. ## Linked issue Closes #6992 ## Why this change #6992 reports three things on phones: 1. **Gboard's language menu closes as soon as it opens.** This comes from Chrome 154 for Android, not from Marinara. Chromium change Ief7ab82699ece79d836d187172a575ff28c001dc ("force text input state update upon window focus changed") hides the soft keyboard when the window loses focus. It was cherry-picked to M154 and is absent in M153. Gboard's menu is a focusable window, so opening it hides the keyboard and the menu with it, on every website. Testing Marinara on staging showed it never moves focus, the caret or the field when keyboard UI blurs the window, resizes the viewport or composes text. A guard test now keeps it that way. 2. **Text along the top edge can't be selected while editing.** This one is ours. On phones, the transparent Roleplay top strip swallowed touches across its full width, and editing put the message's first line under it. That alignment shipped in 2.4.6 (#5851). 3. **On iPhone, the end of a long edited message can't be reached.** The editor was taller than the space above the keyboard, because iOS doesn't shrink `dvh` for it. ## What changed - **Roleplay, phones:** editing now starts below the top buttons. While you edit, the strip around them lets taps through except on the buttons themselves. - **Conversation, phones:** the see-through header lets touches through except on its card, menu buttons and package controls. Opening the keyboard while editing keeps the first line below the header (`scroll-pt-16`). - **iPad:** opening the keyboard while editing a long Roleplay message brings its first line back below the top controls, using the transcript's scroll padding. - **iPhone:** a long edited message fits above the keyboard together with its Save button. - **Tests:** `e2e/roleplay-mobile-editing.e2e.ts` is new, and `e2e/ipad-touch.e2e.ts` is extended. They cover: - first-line touches in Roleplay and Conversation; - the iPhone fit with Save; - iPad short and long replies; - a guard that keyboard pop-ups leave the focused field, its caret and its text alone. - **CHANGELOG:** one entry. ## Validation - [ ] `pnpm check` passes locally - [ ] Container (Docker / Podman) built and ran without issue - [ ] Ran the app, clicked through the changes manually - [ ] Checked edge cases (light + dark mode, mobile viewport, empty states, error paths) - [ ] Above manual verification completed (describe below) - [ ] Read and followed `CONTRIBUTING.md` ### Manual verification notes Run by the agent: - `pnpm check`, `pnpm localization:check` and `pnpm smoke:ui` (desktop) pass. - The mobile Playwright sets pass on mobile-chromium, mobile-webkit and iPad: `roleplay-mobile-editing`, `ipad-touch`, and the related `core-flows`, `client-runtime-diagnostics`, `author-notes` and `chat-lorebook-entry-scope` cases. Device-specific skips are by design. - Each fix was reverted on its own, and its test then fails. Each fix restored passes. - Two adversarial reviews ran. Their findings were fixed: the iPad first line, the Conversation header, the Conversation keyboard edit, and the CHANGELOG wording. - One unrelated flake: "mobile transcript swipes navigate Conversation and Roleplay alternatives" failed once on mobile-chromium, then passed 3/3 alone. It sends synthetic touches, with no scrolling involved. Still to verify by hand: - On an Android phone with Chrome 154, focus a text field on any website (not Marinara) and long-press Gboard's spacebar. The Change keyboard menu closes there too, which confirms Chrome is the cause. - On a real iPhone (Safari and the installed app), edit a long Roleplay message. Scrolling inside the editor reaches the last lines above the keyboard, and Save can be tapped. - On an Android phone, edit a Roleplay message and long-press words on its first line, including near the right edge. They select. - On an iPad, edit a long Roleplay message with agents on and open the keyboard. The first line sits below the top controls and can be pressed. Also try it in a Conversation chat, which no test covers. - In a Conversation chat on a phone, edit the latest long reply and open the keyboard. The first line sits below the header, and the header's buttons still work. ## Docs and release impact - [ ] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed - [ ] Translated docs on the `docs-i18n` branch updated to match, or a `[docs-i18n]` follow-up issue opened (see CONTRIBUTING.md § Translated documentation) - [ ] Version/release files updated (only if this PR includes a version bump) CHANGELOG updated; no user docs change. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Improved mobile message editing so the editor and Save button remain accessible above the on-screen keyboard, including for long replies. * Improved touch targeting around chat controls and headers, and adjusted scrolling to keep edited messages visible. * Preserved editor and composer focus, cursor position, and text during mobile keyboard and viewport changes. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-23 04:19:44 +07:00
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#7432
No description provided.