Skip to content

Commit f3ee2d0

Browse files
committed
fix(web): clicking a secret request card focuses its field again
1 parent 5b70d81 commit f3ee2d0

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

‎apps/web/src/components/chat/SecretRequestCard.tsx‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,13 @@ function PendingSecretRequestForm(props: {
101101
className="flex min-w-0 flex-col gap-3 rounded-xl border border-border/60 bg-card p-4"
102102
onSubmit={onSubmit}
103103
autoComplete="off"
104-
onPointerDown={(event) => {
105-
if (!(event.target instanceof HTMLElement)) return;
104+
// On click, not pointerdown: the mousedown that follows a pointerdown
105+
// moves focus back off the input. A click that ends a text selection
106+
// leaves it alone so the reason can still be copied.
107+
onClick={(event) => {
108+
if (!(event.target instanceof Element)) return;
106109
if (event.target.closest("input, button, a")) return;
110+
if (window.getSelection()?.isCollapsed === false) return;
107111
document.getElementById(inputId)?.focus();
108112
}}
109113
>

0 commit comments

Comments
 (0)