[PR #7181] [MERGED] fix(chat): keep chat controls off other screens and let the Agents button close its panel #7613

Closed
opened 2026-10-24 04:05:51 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

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

Base: staging ← Head: fix/new-ui-overlaps-7176


📝 Commits (7)

  • 8d31dd9 fix(chat): keep chat controls off other screens and let the Agents button close its panel
  • 5eefb03 test(e2e): make the covered-chat regression's return step deterministic
  • 1f2ed10 test(e2e): cover a pinned chat window behind covering screens
  • a8908a3 fix(chat): move keyboard focus into the Tracker Panel when it covers the chat
  • f724bca Merge remote-tracking branch 'origin/staging' into fix/new-ui-overlaps-7176
  • 0134cf9 docs: the Tracker Panel button opens and closes the panel (#7176)
  • e9addc7 Merge branch 'staging' into fix/new-ui-overlaps-7176

📊 Changes

9 files changed (+262 additions, -9 deletions)

View changed files

📝 CHANGELOG.md (+1 -0)
📝 docs/chats/chat-settings.md (+1 -1)
📝 docs/roleplay/hud-and-trackers.md (+1 -1)
➕ e2e/chat-controls-covered.e2e.ts (+229 -0)
📝 e2e/phone-bubbles.e2e.ts (+1 -1)
📝 e2e/tracker-window-routing.e2e.ts (+1 -1)
📝 packages/client/src/components/chat/TrackerPanelBubble.tsx (+9 -4)
📝 packages/client/src/components/layout/AppShell.tsx (+13 -1)
📝 packages/client/src/styles/globals.css (+6 -0)

📄 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

Refs #7176

This fixes parts 1 and 2 of #7176. Part 3 (the Relationship Tracker cannot be minimised) is being handled separately by Crimson Orc, so this PR does not close the issue.

Why this change

On the Android app on a Honor foldable (856 CSS px wide), the reporter saw two problems:

  1. After opening a chat and then going to another top-bar screen without going Home first (Agents list, an agent editor, Characters, Settings), the chat's round buttons (activity, gallery, edit, branch, search, Chat Settings and the d20 Trackers button) stayed on top of that screen. They covered its header buttons, such as Back, Save and export.
  2. The floating d20 Trackers button stayed on top of the open Tracker Panel, right on the panel's own d20 close button. Pressing it again did nothing, so it could open the panel but never close it.

The maintainer couldn't reproduce this on a phone or a desktop because it only happens between the two layouts. Root cause:

  • The shell lays panels, editors and the Tracker Panel over a chat that stays mounted (z 45–50) whenever it is in overlay mode. Overlay mode comes from MOBILE_SHELL_MEDIA_QUERY plus a width-capacity check, so it covers touch screens up to 1440 px and any window narrower than 2 × sidebar width + 384 (1024 px by default).
  • The chat's window bubbles and windows pick their layer by the phone breakpoint (max-width: 767px). Below it they sit at z 44, under those overlays. Above it they use the window layer, z 70 and up.
  • From 768 px up to the overlay limit (for example the 856 px foldable, or an 856 px desktop window) the chat's z-70 layer is drawn over the other screen. The same happens over the overlay Tracker Panel, where the d20 sat on the panel's own d20 close button.
  • TrackerPanelBubble.onOpen only ever called openWindow, so the button could not close the panel.

What changed

  • AppShell.tsx: the chat wrapper gets data-chat-covered="true" whenever the existing chatSurfaceActive is false, meaning a panel, editor, chat list or the overlay Tracker Panel is showing instead of the chat. This reuses the shell's own decision, so it holds at every width.
  • globals.css: one rule hides the chat's .mari-window, .mari-window-bubble and the Chat Settings move tip (visibility: hidden) under that marker, next to the existing rule that hides them under chat-local modals. Positions are not touched, so the buttons come back exactly where they were. On phones those elements were already underneath the overlays. On desktop the chat is already hidden or unmounted whenever this is true, so neither changes.
  • TrackerPanelBubble.tsx: the d20 now toggles like the Chat Settings button. A second press closes the panel through the existing closeTrackerPanel(), it keeps aria-expanded, and its accessible name and tooltip are now plain "Trackers" instead of "Open Trackers", following the WindowBubble ariaLabel contract for toggling buttons.
  • AppShell.tsx (follow-up commit): when the Tracker Panel opens over the chat in overlay layouts, it hides the chat control that opened it, so a keyboard user's focus would drop to the page. If focus was in the covered chat, it now moves to the panel (tabIndex={-1}, outline-none like FloatingWindow's own focus target). Tab then reaches the panel's close button, and closing the panel returns focus to the Trackers button through the existing effect in TrackerPanelBubble. Desktop docked layouts are unchanged: focus stays on the d20.
  • e2e/chat-controls-covered.e2e.ts (new regression):
    • At 856×904 in Chromium and with the Android app user agent plus touch, the chat's buttons are hidden over the Tracker Panel, the Agents list and the agent editor, and presses at their old spots reach the screen on top, including the editor's Save and Back buttons. A pinned Chat Settings window stays open but hidden behind those screens. The buttons and the window come back in the same place.
    • At 1280 the d20 opens and closes the docked panel, focus stays on it, and an editor still replaces the chat.
    • At phone width the d20 still opens the panel, which covers it, and the button returns to its spot.
  • e2e/tracker-window-routing.e2e.ts, e2e/phone-bubbles.e2e.ts: the d20's expected accessible name is now "Trackers".
  • CHANGELOG.md: user-facing 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

Agent-run results (not a substitute for the boxes above):

  • Reproduced both bugs before the fix with Playwright at 856×904, in plain Chromium and with the Android app user agent plus touch. Chat buttons stayed visible over the Tracker Panel, the Agents list, the agent editor, Characters and Settings. The d20 intercepted the click on the panel's own close button. Pressing the d20 again left the panel open.
  • pnpm regression:ui e2e/chat-controls-covered.e2e.ts --project=desktop-chromium: fails 3/3 on the unfixed code and passes 3/3 with the fix.
  • pnpm check: passes. pnpm localization:check: passes (no new strings). prettier --check on the changed files: passes, except globals.css, which already fails on staging because of an unrelated selector at about line 6491. That hunk was left alone.
  • Phone projects and related tracker/bubble specs: see the validation comment below.

Manual verification notes

  • Manually verify on a foldable or tablet in the Android app (or a desktop browser window about 856 px wide):
    • Open a Roleplay chat with agents on, then open Agents → an agent editor without going Home. No chat buttons cover the header, and Back, Save and export all respond to a tap.
    • Repeat with Characters, Lorebooks and Settings from the top bar, then return to the chat. Every chat button is back in its old place.
    • With the Tracker Panel open, neither the floating d20 nor the Chat Settings button shows on top of it. The panel's own d20 closes it, and the floating d20 reappears.
  • Manually verify with the keyboard at about 856 px wide: Tab to the floating d20 and press Enter. The panel opens and focus is inside it, Tab reaches the panel's close button, and Enter there closes the panel and puts focus back on the d20.
  • Manually verify on a computer (1280 px or wider) that pressing the floating d20 closes the docked Tracker Panel and pressing it again reopens it, and that a screen reader announces it as "Trackers", expanded or collapsed.
  • Manually verify on a phone (390 px) that the chat buttons and the d20 behave as before: the d20 opens the panel, and closing the panel brings the button back.
  • Manually verify in light and dark mode, with a pinned chat window open on a tablet-width screen, that the pinned window hides while another screen is open and comes back afterwards.

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 has an [Unreleased] entry. No docs/ pages change.

UI evidence (if applicable)

At 856×904 with the Android app user agent, before the fix: in the agent editor the d20 covers Back and the Chat Settings button covers export. Over the Tracker Panel the d20 sits on the panel's own d20 close button and the Chat Settings button covers the panel's header controls. After the fix, neither screen shows any chat buttons. The screenshots were captured locally by the regression run (chat-controls-covered output) and are not attached here.

Summary by CodeRabbit

  • Bug Fixes
    • On tablets, foldable devices, and narrow windows, chat windows and floating controls no longer cover controls in other panels or editors. Hidden chat buttons return to their previous positions when the chat is visible again.
    • Pressing Trackers again closes the Tracker Panel.
    • When the Tracker Panel opens over chat, keyboard focus moves into the panel and returns when it closes.

🔄 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/7181 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 10/6/2026 **Status:** ✅ Merged **Merged:** 10/6/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `fix/new-ui-overlaps-7176` --- ### 📝 Commits (7) - [`8d31dd9`](https://github.com/Pasta-Devs/Marinara-Engine/commit/8d31dd9c4178c04aa53960baba9db28ccb99c0a7) fix(chat): keep chat controls off other screens and let the Agents button close its panel - [`5eefb03`](https://github.com/Pasta-Devs/Marinara-Engine/commit/5eefb033976425bb1054994e76d433b3329f4dc1) test(e2e): make the covered-chat regression's return step deterministic - [`1f2ed10`](https://github.com/Pasta-Devs/Marinara-Engine/commit/1f2ed108a5a4640db37c745ff9cd94b6d2f87487) test(e2e): cover a pinned chat window behind covering screens - [`a8908a3`](https://github.com/Pasta-Devs/Marinara-Engine/commit/a8908a3d3a5f54f4960c65339e3dcc5c652b8df1) fix(chat): move keyboard focus into the Tracker Panel when it covers the chat - [`f724bca`](https://github.com/Pasta-Devs/Marinara-Engine/commit/f724bca89f4225d131b9b8a96cae01f34a00e1f7) Merge remote-tracking branch 'origin/staging' into fix/new-ui-overlaps-7176 - [`0134cf9`](https://github.com/Pasta-Devs/Marinara-Engine/commit/0134cf95ed695ecb9eadd13ec59067ac8f00dca1) docs: the Tracker Panel button opens and closes the panel (#7176) - [`e9addc7`](https://github.com/Pasta-Devs/Marinara-Engine/commit/e9addc7ef4e25583bbf84067911fe272dacbabcb) Merge branch 'staging' into fix/new-ui-overlaps-7176 ### 📊 Changes **9 files changed** (+262 additions, -9 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+1 -0) 📝 `docs/chats/chat-settings.md` (+1 -1) 📝 `docs/roleplay/hud-and-trackers.md` (+1 -1) ➕ `e2e/chat-controls-covered.e2e.ts` (+229 -0) 📝 `e2e/phone-bubbles.e2e.ts` (+1 -1) 📝 `e2e/tracker-window-routing.e2e.ts` (+1 -1) 📝 `packages/client/src/components/chat/TrackerPanelBubble.tsx` (+9 -4) 📝 `packages/client/src/components/layout/AppShell.tsx` (+13 -1) 📝 `packages/client/src/styles/globals.css` (+6 -0) </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`. <!-- See CONTRIBUTING.md § Branches. --> ## Linked issue Refs #7176 This fixes parts 1 and 2 of #7176. Part 3 (the Relationship Tracker cannot be minimised) is being handled separately by Crimson Orc, so this PR does not close the issue. ## Why this change On the Android app on a Honor foldable (856 CSS px wide), the reporter saw two problems: 1. After opening a chat and then going to another top-bar screen without going Home first (Agents list, an agent editor, Characters, Settings), the chat's round buttons (activity, gallery, edit, branch, search, Chat Settings and the d20 Trackers button) stayed on top of that screen. They covered its header buttons, such as **Back**, **Save** and export. 2. The floating d20 Trackers button stayed on top of the open Tracker Panel, right on the panel's own d20 close button. Pressing it again did nothing, so it could open the panel but never close it. The maintainer couldn't reproduce this on a phone or a desktop because it only happens between the two layouts. Root cause: - The shell lays panels, editors and the Tracker Panel over a chat that **stays mounted** (z 45–50) whenever it is in overlay mode. Overlay mode comes from `MOBILE_SHELL_MEDIA_QUERY` plus a width-capacity check, so it covers touch screens up to 1440 px and any window narrower than `2 × sidebar width + 384` (1024 px by default). - The chat's window bubbles and windows pick their layer by the **phone** breakpoint `(max-width: 767px)`. Below it they sit at z 44, under those overlays. Above it they use the window layer, z 70 and up. - From 768 px up to the overlay limit (for example the 856 px foldable, or an 856 px desktop window) the chat's z-70 layer is drawn over the other screen. The same happens over the overlay Tracker Panel, where the d20 sat on the panel's own d20 close button. - `TrackerPanelBubble.onOpen` only ever called `openWindow`, so the button could not close the panel. ## What changed - `AppShell.tsx`: the chat wrapper gets `data-chat-covered="true"` whenever the existing `chatSurfaceActive` is false, meaning a panel, editor, chat list or the overlay Tracker Panel is showing instead of the chat. This reuses the shell's own decision, so it holds at every width. - `globals.css`: one rule hides the chat's `.mari-window`, `.mari-window-bubble` and the Chat Settings move tip (`visibility: hidden`) under that marker, next to the existing rule that hides them under chat-local modals. Positions are not touched, so the buttons come back exactly where they were. On phones those elements were already underneath the overlays. On desktop the chat is already hidden or unmounted whenever this is true, so neither changes. - `TrackerPanelBubble.tsx`: the d20 now toggles like the **Chat Settings** button. A second press closes the panel through the existing `closeTrackerPanel()`, it keeps `aria-expanded`, and its accessible name and tooltip are now plain "Trackers" instead of "Open Trackers", following the `WindowBubble` `ariaLabel` contract for toggling buttons. - `AppShell.tsx` (follow-up commit): when the Tracker Panel opens over the chat in overlay layouts, it hides the chat control that opened it, so a keyboard user's focus would drop to the page. If focus was in the covered chat, it now moves to the panel (`tabIndex={-1}`, `outline-none` like `FloatingWindow`'s own focus target). Tab then reaches the panel's close button, and closing the panel returns focus to the Trackers button through the existing effect in `TrackerPanelBubble`. Desktop docked layouts are unchanged: focus stays on the d20. - `e2e/chat-controls-covered.e2e.ts` (new regression): - At 856×904 in Chromium and with the Android app user agent plus touch, the chat's buttons are hidden over the Tracker Panel, the Agents list and the agent editor, and presses at their old spots reach the screen on top, including the editor's **Save** and **Back** buttons. A pinned Chat Settings window stays open but hidden behind those screens. The buttons and the window come back in the same place. - At 1280 the d20 opens and closes the docked panel, focus stays on it, and an editor still replaces the chat. - At phone width the d20 still opens the panel, which covers it, and the button returns to its spot. - `e2e/tracker-window-routing.e2e.ts`, `e2e/phone-bubbles.e2e.ts`: the d20's expected accessible name is now "Trackers". - `CHANGELOG.md`: user-facing 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` Agent-run results (not a substitute for the boxes above): - Reproduced both bugs before the fix with Playwright at 856×904, in plain Chromium and with the Android app user agent plus touch. Chat buttons stayed visible over the Tracker Panel, the Agents list, the agent editor, Characters and Settings. The d20 intercepted the click on the panel's own close button. Pressing the d20 again left the panel open. - `pnpm regression:ui e2e/chat-controls-covered.e2e.ts --project=desktop-chromium`: fails 3/3 on the unfixed code and passes 3/3 with the fix. - `pnpm check`: passes. `pnpm localization:check`: passes (no new strings). `prettier --check` on the changed files: passes, except `globals.css`, which already fails on `staging` because of an unrelated selector at about line 6491. That hunk was left alone. - Phone projects and related tracker/bubble specs: see the validation comment below. ### Manual verification notes - Manually verify on a foldable or tablet in the Android app (or a desktop browser window about 856 px wide): - Open a Roleplay chat with agents on, then open Agents → an agent editor without going Home. No chat buttons cover the header, and **Back**, **Save** and export all respond to a tap. - Repeat with Characters, Lorebooks and Settings from the top bar, then return to the chat. Every chat button is back in its old place. - With the Tracker Panel open, neither the floating d20 nor the Chat Settings button shows on top of it. The panel's own d20 closes it, and the floating d20 reappears. - Manually verify with the keyboard at about 856 px wide: Tab to the floating d20 and press Enter. The panel opens and focus is inside it, Tab reaches the panel's close button, and Enter there closes the panel and puts focus back on the d20. - Manually verify on a computer (1280 px or wider) that pressing the floating d20 closes the docked Tracker Panel and pressing it again reopens it, and that a screen reader announces it as "Trackers", expanded or collapsed. - Manually verify on a phone (390 px) that the chat buttons and the d20 behave as before: the d20 opens the panel, and closing the panel brings the button back. - Manually verify in light and dark mode, with a pinned chat window open on a tablet-width screen, that the pinned window hides while another screen is open and comes back afterwards. ## 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 has an `[Unreleased]` entry. No `docs/` pages change. ## UI evidence (if applicable) At 856×904 with the Android app user agent, before the fix: in the agent editor the d20 covers **Back** and the Chat Settings button covers export. Over the Tracker Panel the d20 sits on the panel's own d20 close button and the Chat Settings button covers the panel's header controls. After the fix, neither screen shows any chat buttons. The screenshots were captured locally by the regression run (`chat-controls-covered` output) and are not attached here. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * On tablets, foldable devices, and narrow windows, chat windows and floating controls no longer cover controls in other panels or editors. Hidden chat buttons return to their previous positions when the chat is visible again. * Pressing **Trackers** again closes the Tracker Panel. * When the Tracker Panel opens over chat, keyboard focus moves into the panel and returns when it closes. <!-- 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-24 04:05:51 +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#7613
No description provided.