[GH-ISSUE #3071] [Issue]: Per-segment "Copy" button on game narration/dialogue is hidden on mobile (hidden md:block) with no tap fallback, so phone players can't copy GM text #1639

Closed
opened 2026-10-21 05:41:12 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @kolacheee on GitHub (Jun 29, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/3071

Originally assigned to: @SpicyMarinara on GitHub.

What's wrong

Each active narration / dialogue / readable segment in the game surface renders a small Copy button in the top-right corner of its card, but that button is styled hidden md:block — meaning display: none below 768px and only visible at desktop width. On a phone the button never renders at all. Unlike the Edit affordance on the same cards (which got a dedicated mobile double-tap handler), there is no tap or long-press gesture wired to the copy action. The net effect is that copying the GM's narration or a character's dialogue line is a desktop-only action; a mobile player has no way to copy the text the GM just wrote.

How to reproduce (try it yourself)

  1. Open a chat in RPG / Game mode on a phone-width viewport (<=767px).
  2. Let the GM produce a narration or dialogue segment, and read to the end so the active segment is displayed in the narration box.
  3. Look at the top-right corner of the narration / dialogue card for a copy control (it is present on desktop).
  4. Try a single tap and a double tap on the segment text.

You'll see: no Copy button is rendered at all; a double-tap only enters Edit mode (and only when the segment is editable), and there is no way to copy the segment's text.

Expected: a reachable Copy control (a visible button, or a tap/long-press gesture) on mobile, matching the desktop affordance.

Where it is

In packages/client/src/components/game/GameNarration.tsx, all three per-segment Copy buttons are gated hidden ... md:block:

  • Dialogue variant, line 4146:
    "absolute top-1.5 hidden rounded p-1 text-[var(--muted-foreground)]/40 transition-colors hover:bg-[var(--muted)]/30 hover:text-[var(--muted-foreground)] md:block dark:text-white/20 dark:hover:bg-white/10 dark:hover:text-white/60"
  • Narration variant, line 4272: identical class string.
  • Readable variant, line 4344:
    "absolute right-1.5 top-1.5 hidden rounded p-1 text-amber-200/45 transition-colors hover:bg-amber-100/10 hover:text-amber-100/70 md:block"

Contrast the Edit button on the same cards (also hidden md:block) which IS backed by a mobile fallback: the segment container wires onPointerDown={(event) => handleMobileSegmentPointerDown(event, active)} and onPointerUp={(event) => handleMobileSegmentTapToEdit(event, active)} (dialogue container 4064-4065, narration container 4208-4209). Those handlers are defined at lines 2125 and 2141 and call setEditingContent(...) on a mobile double-tap. No equivalent gesture calls handleCopyMessage (defined at line 3399) — its only callers are the three md:block buttons (4143 / 4269 / 4342) plus a separate log-copy feature at line 3426. The readable-variant container (around 4320) has no pointer handlers at all.

What's happening

Tailwind hidden md:block compiles to display: none with a @media (min-width: 768px) { display: block } override. At <=767px the Copy button is removed from the layout entirely (not merely transparent or off-screen), so it cannot be tapped. The narration container's pointer handlers gate strictly on edit (activeCanEditSegment) and only ever call setEditingContent (line 2162) — they never call handleCopyMessage. So at phone widths there is no rendered control AND no gesture code path that reaches the copy action. The control reappears at >=768px purely because of the md:block override.

Suggested fix

Render a mobile-only sibling Copy button next to (not replacing) each existing md:block button, wired to the existing handleCopyMessage(activeCopyKey, activeCopyText). For each of the three sites, add a second button with the same per-variant color/hover tokens but classed block md:hidden instead of hidden md:block, and pin it to right-1.5 unconditionally (drop the activeCanEditSegment ? "right-7" : "right-1.5" branch on the mobile copy, since the Edit button is itself hidden md:block and never renders on phones, leaving the top-right corner free). Keep the desktop button exactly as-is. Reuse the existing per-variant tokens (var(--muted-foreground)/40 plus dark: variants for dialogue/narration; amber-200/45 for readable) so light/dark/sillytavern theming stays identical, and gate on activeCopyKey exactly as the desktop button does. A max-md:-visible pattern is already proven in this same file (max-md:opacity-100 at lines 3997 and 4917). Alternatively (also acceptable, even lower visual risk), add a Copy entry to the mobile-visible meta-button row at line 4171 / 4285 / 4355, alongside Logs/Inventory.

Regression avoided: do NOT remove or relax hidden md:block on the existing desktop button, and do NOT collapse it into a single always-visible button. Adding a block md:hidden sibling leaves the desktop button byte-for-byte unchanged (zero desktop visual change) and adds a control only below 768px. Collapsing to one always-visible button would instead change desktop appearance and entangle the activeCanEditSegment ? "right-7" : "right-1.5" offset (that right-7 exists to dodge the Edit button, which is absent on mobile, so an always-on button reusing it would float with a dead gap on phones). The buttons are absolutely positioned overlays inside their own relative card, so no flex reflow or z-index is affected, and the shared color tokens keep all themes consistent.

AI-investigated against v2.0.6 (packages/client); cited lines read and confirmed. Mobile layout verified by reading the computed Tailwind classes + globals.css, not on a device — please confirm on a phone before fixing.

Originally created by @kolacheee on GitHub (Jun 29, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/3071 Originally assigned to: @SpicyMarinara on GitHub. **What's wrong** Each active narration / dialogue / readable segment in the game surface renders a small Copy button in the top-right corner of its card, but that button is styled `hidden md:block` — meaning `display: none` below 768px and only visible at desktop width. On a phone the button never renders at all. Unlike the Edit affordance on the same cards (which got a dedicated mobile double-tap handler), there is no tap or long-press gesture wired to the copy action. The net effect is that copying the GM's narration or a character's dialogue line is a desktop-only action; a mobile player has no way to copy the text the GM just wrote. **How to reproduce (try it yourself)** 1. Open a chat in RPG / Game mode on a phone-width viewport (<=767px). 2. Let the GM produce a narration or dialogue segment, and read to the end so the active segment is displayed in the narration box. 3. Look at the top-right corner of the narration / dialogue card for a copy control (it is present on desktop). 4. Try a single tap and a double tap on the segment text. You'll see: no Copy button is rendered at all; a double-tap only enters Edit mode (and only when the segment is editable), and there is no way to copy the segment's text. Expected: a reachable Copy control (a visible button, or a tap/long-press gesture) on mobile, matching the desktop affordance. **Where it is** In `packages/client/src/components/game/GameNarration.tsx`, all three per-segment Copy buttons are gated `hidden ... md:block`: - Dialogue variant, line 4146: `"absolute top-1.5 hidden rounded p-1 text-[var(--muted-foreground)]/40 transition-colors hover:bg-[var(--muted)]/30 hover:text-[var(--muted-foreground)] md:block dark:text-white/20 dark:hover:bg-white/10 dark:hover:text-white/60"` - Narration variant, line 4272: identical class string. - Readable variant, line 4344: `"absolute right-1.5 top-1.5 hidden rounded p-1 text-amber-200/45 transition-colors hover:bg-amber-100/10 hover:text-amber-100/70 md:block"` Contrast the Edit button on the same cards (also `hidden md:block`) which IS backed by a mobile fallback: the segment container wires `onPointerDown={(event) => handleMobileSegmentPointerDown(event, active)}` and `onPointerUp={(event) => handleMobileSegmentTapToEdit(event, active)}` (dialogue container 4064-4065, narration container 4208-4209). Those handlers are defined at lines 2125 and 2141 and call `setEditingContent(...)` on a mobile double-tap. No equivalent gesture calls `handleCopyMessage` (defined at line 3399) — its only callers are the three `md:block` buttons (4143 / 4269 / 4342) plus a separate log-copy feature at line 3426. The readable-variant container (around 4320) has no pointer handlers at all. **What's happening** Tailwind `hidden md:block` compiles to `display: none` with a `@media (min-width: 768px) { display: block }` override. At <=767px the Copy button is removed from the layout entirely (not merely transparent or off-screen), so it cannot be tapped. The narration container's pointer handlers gate strictly on edit (`activeCanEditSegment`) and only ever call `setEditingContent` (line 2162) — they never call `handleCopyMessage`. So at phone widths there is no rendered control AND no gesture code path that reaches the copy action. The control reappears at >=768px purely because of the `md:block` override. **Suggested fix** Render a mobile-only sibling Copy button next to (not replacing) each existing `md:block` button, wired to the existing `handleCopyMessage(activeCopyKey, activeCopyText)`. For each of the three sites, add a second button with the same per-variant color/hover tokens but classed `block md:hidden` instead of `hidden md:block`, and pin it to `right-1.5` unconditionally (drop the `activeCanEditSegment ? "right-7" : "right-1.5"` branch on the mobile copy, since the Edit button is itself `hidden md:block` and never renders on phones, leaving the top-right corner free). Keep the desktop button exactly as-is. Reuse the existing per-variant tokens (`var(--muted-foreground)`/40 plus `dark:` variants for dialogue/narration; `amber-200/45` for readable) so light/dark/sillytavern theming stays identical, and gate on `activeCopyKey` exactly as the desktop button does. A `max-md:`-visible pattern is already proven in this same file (`max-md:opacity-100` at lines 3997 and 4917). Alternatively (also acceptable, even lower visual risk), add a Copy entry to the mobile-visible meta-button row at line 4171 / 4285 / 4355, alongside Logs/Inventory. Regression avoided: do NOT remove or relax `hidden md:block` on the existing desktop button, and do NOT collapse it into a single always-visible button. Adding a `block md:hidden` sibling leaves the desktop button byte-for-byte unchanged (zero desktop visual change) and adds a control only below 768px. Collapsing to one always-visible button would instead change desktop appearance and entangle the `activeCanEditSegment ? "right-7" : "right-1.5"` offset (that `right-7` exists to dodge the Edit button, which is absent on mobile, so an always-on button reusing it would float with a dead gap on phones). The buttons are absolutely positioned overlays inside their own relative card, so no flex reflow or z-index is affected, and the shared color tokens keep all themes consistent. *AI-investigated against v2.0.6 (packages/client); cited lines read and confirmed. Mobile layout verified by reading the computed Tailwind classes + globals.css, not on a device — please confirm on a phone before fixing.*
Author
Owner

@SpicyMarinara commented on GitHub (Jun 29, 2026):

Addressed in PR #3072 by commit 4146a380. Validated locally with pnpm check and pnpm smoke:ui.

<!-- gh-comment-id:4836258938 --> @SpicyMarinara commented on GitHub (Jun 29, 2026): Addressed in PR #3072 by commit 4146a380. Validated locally with pnpm check and pnpm smoke:ui.
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#1639
No description provided.