[GH-ISSUE #3065] [Issue]: In roleplay chats the emoji picker button is hidden on phone-width screens, leaving mobile users with no way to open the in-app emoji picker #1632

Closed
opened 2026-10-21 05:41:08 +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/3065

Originally assigned to: @SpicyMarinara on GitHub.

What's wrong

In roleplay-mode chats, the emoji picker button in the input bar is completely hidden on phone-width screens (anything below 640px wide, i.e. virtually every phone held in portrait). The button lives inside a hidden sm:block wrapper, which means it renders as display:none on phones and only appears on tablet/desktop widths. Unlike conversation-mode chats — which deliberately render a separate mobile-only smiley button that opens an emoji/GIF/sticker sheet — roleplay mode provides no mobile substitute whatsoever. The emoji picker itself works fine; it's just unreachable on a phone because its only entry point is unconditionally hidden with nothing rendered in its place. A mobile roleplay user simply has no way to reach the app's emoji picker.

How to reproduce (try it yourself)

  1. Open the app on a phone-width viewport (e.g. 390px wide), or use the browser DevTools device toolbar at 390x844.
  2. Open or create a ROLEPLAY-mode chat (not a conversation / Discord-style chat).
  3. Look at the input bar at the bottom. You'll see the Paperclip (attach) button, the quick-switcher chevron, the textarea, and the Send button — but no emoji (smiley) button.
  4. For contrast, open a conversation-mode chat at the same 390px width: there a smiley button is present and tapping it opens an emoji/GIF/sticker sheet.

You'll see: roleplay mode has no emoji button anywhere on mobile; the picker is unreachable.
Expected: roleplay mode should expose the emoji picker on mobile too (e.g. via a mobile-only smiley button), matching how conversation mode behaves.

Where it is

packages/client/src/components/chat/ChatInput.tsx line 1504 wraps the only emoji entry point:

{/* Emoji picker */}
<div className="relative hidden sm:block">
  <button ref={emojiButtonRef} onClick={() => setEmojiOpen((v) => !v)} ...>
    <Smile size="1.125rem" />
  </button>
  <EmojiPicker open={emojiOpen} ... anchorRef={emojiButtonRef} containerRef={inputBarRef} />
</div>

This is the entire emoji affordance in the file — Smile appears only at line 1516, EmojiPicker only at line 1518, both nested inside this single hidden sm:block container, and there is no sm:hidden emoji affordance — the only sm:hidden element in this input bar is the unrelated QuickSwitcherMobile (line 1475, a connection/persona switcher), not an emoji entry point.

The sibling that does it right is packages/client/src/components/chat/ConversationInput.tsx lines 1951-1971, which render a mobile-only sm:hidden Smile button (comment at line 1950: "Mobile: one multipurpose button → Emoji/GIFs/Stickers sheet") toggling mobilePickerOpen, in addition to the desktop hidden sm:block emoji button at lines 2000-2030. So conversation mode keeps an emoji affordance on phones; roleplay mode does not.

What's happening

hidden sm:block compiles to display:none at widths below the Tailwind sm breakpoint (640px) and display:block at >= 640px. Because the emoji button is the only emoji entry point in ChatInput.tsx and it is gated entirely behind sm:block, the whole control computes to display:none on phone-portrait widths (<= 639px) and reappears only at >= 640px. No max-md: / sm:hidden mobile alternative is rendered, and styles/globals.css contains no override that re-shows it — the mobile media queries (max-width: 767px, max-width: 479px, pointer: coarse) only touch scrollbars and input font-size, never this container. So the utility is genuinely absent on mobile, not merely restyled.

Suggested fix

Mirror the conversation-mode pattern, but give the mobile trigger its own visible anchor so the portal-positioned picker lands correctly across the full sub-640px range. As a sibling next to the textarea (outside the existing hidden sm:block wrapper, which stays untouched), add a sm:hidden Smile button with its own ref (e.g. mobileEmojiButtonRef) and the standard 44px touch-target classes (flex h-11 w-11 items-center justify-center rounded-xl ... sm:hidden) toggling the existing emojiOpen state, immediately followed by its own <EmojiPicker open={emojiOpen} onClose={() => setEmojiOpen(false)} onSelect={handleEmojiSelect} anchorRef={mobileEmojiButtonRef} containerRef={inputBarRef} />. Keep the desktop button at lines 1504-1525 byte-for-byte unchanged. Because the desktop picker is anchored to emojiButtonRef inside hidden sm:block and the mobile picker is anchored to a button visible only below 640px, exactly one is reachable per breakpoint and they share the single emojiOpen state cleanly.

Important: do NOT take the naive shortcut of just adding a second visible button that reuses the existing <EmojiPicker anchorRef={emojiButtonRef}> (the desktop one). On mobile that desktop anchor button is display:none, so its getBoundingClientRect() returns all zeros; the picker's positioning effect then computes right = vw - btnRect.right = vw, shoving the panel off-screen on 480-639px-wide phones. Giving the mobile button its own visible anchor avoids this entirely. (Minor consistency note, out of scope: this file's desktop EmojiPicker omits the customTab custom-emoji tab that ConversationInput passes — the new mobile instance should match the desktop instance in this file, i.e. omit customTab, so the two roleplay pickers stay consistent.)

Regression avoided: the new trigger is sm:hidden (display:none at >= 640px), so desktop and >= 768px layouts and the light/dark/sillytavern themes are untouched. ChatInput.tsx is roleplay-only (used solely by ChatRoleplaySurface.tsx); conversation mode uses ConversationInput.tsx and game mode uses GameInput.tsx, so this change cannot affect them. The new button reuses the same foreground/* token classes and the h-11 w-11 / sm:h-8 sm:w-8 touch-target convention already used by the Paperclip and Send buttons, so it slots into the flex row without reflow, and EmojiPicker renders via createPortal to document.body with position:fixed, so it isn't clipped by the input bar's rounded/overflow shell.

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/3065 Originally assigned to: @SpicyMarinara on GitHub. **What's wrong** In roleplay-mode chats, the emoji picker button in the input bar is completely hidden on phone-width screens (anything below 640px wide, i.e. virtually every phone held in portrait). The button lives inside a `hidden sm:block` wrapper, which means it renders as `display:none` on phones and only appears on tablet/desktop widths. Unlike conversation-mode chats — which deliberately render a separate mobile-only smiley button that opens an emoji/GIF/sticker sheet — roleplay mode provides no mobile substitute whatsoever. The emoji picker itself works fine; it's just unreachable on a phone because its only entry point is unconditionally hidden with nothing rendered in its place. A mobile roleplay user simply has no way to reach the app's emoji picker. **How to reproduce (try it yourself)** 1. Open the app on a phone-width viewport (e.g. 390px wide), or use the browser DevTools device toolbar at 390x844. 2. Open or create a ROLEPLAY-mode chat (not a conversation / Discord-style chat). 3. Look at the input bar at the bottom. You'll see the Paperclip (attach) button, the quick-switcher chevron, the textarea, and the Send button — but no emoji (smiley) button. 4. For contrast, open a conversation-mode chat at the same 390px width: there a smiley button is present and tapping it opens an emoji/GIF/sticker sheet. You'll see: roleplay mode has no emoji button anywhere on mobile; the picker is unreachable. Expected: roleplay mode should expose the emoji picker on mobile too (e.g. via a mobile-only smiley button), matching how conversation mode behaves. **Where it is** `packages/client/src/components/chat/ChatInput.tsx` line 1504 wraps the only emoji entry point: ```tsx {/* Emoji picker */} <div className="relative hidden sm:block"> <button ref={emojiButtonRef} onClick={() => setEmojiOpen((v) => !v)} ...> <Smile size="1.125rem" /> </button> <EmojiPicker open={emojiOpen} ... anchorRef={emojiButtonRef} containerRef={inputBarRef} /> </div> ``` This is the entire emoji affordance in the file — `Smile` appears only at line 1516, `EmojiPicker` only at line 1518, both nested inside this single `hidden sm:block` container, and there is no `sm:hidden` *emoji* affordance — the only `sm:hidden` element in this input bar is the unrelated `QuickSwitcherMobile` (line 1475, a connection/persona switcher), not an emoji entry point. The sibling that does it right is `packages/client/src/components/chat/ConversationInput.tsx` lines 1951-1971, which render a mobile-only `sm:hidden` Smile button (comment at line 1950: "Mobile: one multipurpose button → Emoji/GIFs/Stickers sheet") toggling `mobilePickerOpen`, in addition to the desktop `hidden sm:block` emoji button at lines 2000-2030. So conversation mode keeps an emoji affordance on phones; roleplay mode does not. **What's happening** `hidden sm:block` compiles to `display:none` at widths below the Tailwind `sm` breakpoint (640px) and `display:block` at >= 640px. Because the emoji button is the only emoji entry point in `ChatInput.tsx` and it is gated entirely behind `sm:block`, the whole control computes to `display:none` on phone-portrait widths (<= 639px) and reappears only at >= 640px. No `max-md:` / `sm:hidden` mobile alternative is rendered, and `styles/globals.css` contains no override that re-shows it — the mobile media queries (`max-width: 767px`, `max-width: 479px`, `pointer: coarse`) only touch scrollbars and input font-size, never this container. So the utility is genuinely absent on mobile, not merely restyled. **Suggested fix** Mirror the conversation-mode pattern, but give the mobile trigger its own visible anchor so the portal-positioned picker lands correctly across the full sub-640px range. As a sibling next to the textarea (outside the existing `hidden sm:block` wrapper, which stays untouched), add a `sm:hidden` Smile button with its own ref (e.g. `mobileEmojiButtonRef`) and the standard 44px touch-target classes (`flex h-11 w-11 items-center justify-center rounded-xl ... sm:hidden`) toggling the existing `emojiOpen` state, immediately followed by its own `<EmojiPicker open={emojiOpen} onClose={() => setEmojiOpen(false)} onSelect={handleEmojiSelect} anchorRef={mobileEmojiButtonRef} containerRef={inputBarRef} />`. Keep the desktop button at lines 1504-1525 byte-for-byte unchanged. Because the desktop picker is anchored to `emojiButtonRef` inside `hidden sm:block` and the mobile picker is anchored to a button visible only below 640px, exactly one is reachable per breakpoint and they share the single `emojiOpen` state cleanly. Important: do NOT take the naive shortcut of just adding a second visible button that reuses the existing `<EmojiPicker anchorRef={emojiButtonRef}>` (the desktop one). On mobile that desktop anchor button is `display:none`, so its `getBoundingClientRect()` returns all zeros; the picker's positioning effect then computes `right = vw - btnRect.right = vw`, shoving the panel off-screen on 480-639px-wide phones. Giving the mobile button its own visible anchor avoids this entirely. (Minor consistency note, out of scope: this file's desktop `EmojiPicker` omits the `customTab` custom-emoji tab that `ConversationInput` passes — the new mobile instance should match the desktop instance in this file, i.e. omit `customTab`, so the two roleplay pickers stay consistent.) Regression avoided: the new trigger is `sm:hidden` (`display:none` at >= 640px), so desktop and >= 768px layouts and the light/dark/sillytavern themes are untouched. `ChatInput.tsx` is roleplay-only (used solely by `ChatRoleplaySurface.tsx`); conversation mode uses `ConversationInput.tsx` and game mode uses `GameInput.tsx`, so this change cannot affect them. The new button reuses the same `foreground/*` token classes and the `h-11 w-11` / `sm:h-8 sm:w-8` touch-target convention already used by the Paperclip and Send buttons, so it slots into the flex row without reflow, and `EmojiPicker` renders via `createPortal` to `document.body` with `position:fixed`, so it isn't clipped by the input bar's rounded/overflow shell. *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:4836256988 --> @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#1632
No description provided.