Skip to content

Commit f62079c

Browse files
committed
feat(chat): reveal user message edit/copy actions on tap (mobile)
The Edit and Copy buttons on user messages were only shown via CSS :hover (group-hover:flex / hover:flex), so they were unreachable on touch devices. Wire the existing per-message isTapped toggle to reveal them on tap, scoped to (hover: none) devices so desktop hover behavior is unchanged.
1 parent fbcf106 commit f62079c

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

src/lib/components/chat/ChatMessage.svelte

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,9 @@
631631
{/if}
632632
{#if (alternatives.length > 1 && editMsdgId === null) || (!loading && !editMode)}
633633
<button
634-
class="hidden h-5 cursor-pointer items-center gap-1 rounded-md px-1.5 py-0.5 text-xs text-gray-400 group-hover:flex hover:flex hover:bg-gray-100 hover:text-gray-500 lg:-right-2 dark:text-gray-400 dark:hover:bg-gray-800 dark:hover:text-gray-300"
634+
class="hidden h-5 cursor-pointer items-center gap-1 rounded-md px-1.5 py-0.5 text-xs text-gray-400 group-hover:flex hover:flex hover:bg-gray-100 hover:text-gray-500 lg:-right-2 dark:text-gray-400 dark:hover:bg-gray-800 dark:hover:text-gray-300 {isTapped
635+
? '[@media(hover:none)]:flex'
636+
: ''}"
635637
title="Edit"
636638
type="button"
637639
onclick={() => {
@@ -643,7 +645,9 @@
643645
Edit
644646
</button>
645647
<button
646-
class="hidden h-5 cursor-pointer items-center gap-1 rounded-md px-1.5 py-0.5 text-xs group-hover:flex hover:flex hover:bg-gray-100 lg:-right-2 dark:hover:bg-gray-800 {isUserMsgCopied
648+
class="hidden h-5 cursor-pointer items-center gap-1 rounded-md px-1.5 py-0.5 text-xs group-hover:flex hover:flex hover:bg-gray-100 lg:-right-2 dark:hover:bg-gray-800 {isTapped
649+
? '[@media(hover:none)]:flex'
650+
: ''} {isUserMsgCopied
647651
? 'text-green-500 dark:text-green-400'
648652
: 'text-gray-400 hover:text-gray-500 dark:text-gray-400 dark:hover:text-gray-300'}"
649653
title="Copy to clipboard"

0 commit comments

Comments
 (0)