diff options
| author | David Hill <[email protected]> | 2026-01-24 06:07:59 +0000 |
|---|---|---|
| committer | David Hill <[email protected]> | 2026-01-24 06:18:55 +0000 |
| commit | 58788192f40aa285a2d1385c169c95aab634b631 (patch) | |
| tree | fe0e52f2b46ac9df14565e600aca3318ad4805b1 | |
| parent | 40ab6ac86227b11080748154349e4060b54ec772 (diff) | |
| download | opencode-58788192f40aa285a2d1385c169c95aab634b631.tar.gz opencode-58788192f40aa285a2d1385c169c95aab634b631.zip | |
fix(ui): close comment input popover on Escape key or click away
| -rw-r--r-- | packages/app/src/pages/session.tsx | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/packages/app/src/pages/session.tsx b/packages/app/src/pages/session.tsx index f8538bb2a..c5997193f 100644 --- a/packages/app/src/pages/session.tsx +++ b/packages/app/src/pages/session.tsx @@ -2059,7 +2059,15 @@ export default function Page() { > <Icon name="comment" size="small" style={{ color: "var(--white)" }} /> </button> - <div class="absolute top-[calc(100%+4px)] right-[-8px] z-40 w-[380px] rounded-[14px] bg-surface-raised-stronger-non-alpha shadow-lg-border-base p-2"> + <div + class="absolute top-[calc(100%+4px)] right-[-8px] z-40 w-[380px] rounded-[14px] bg-surface-raised-stronger-non-alpha shadow-lg-border-base p-2" + onFocusOut={(e) => { + const target = e.relatedTarget as Node | null + if (!target || !e.currentTarget.contains(target)) { + setCommenting(null) + } + }} + > <div class="flex flex-col gap-2"> <textarea ref={textarea} @@ -2069,6 +2077,10 @@ export default function Page() { value={draft()} onInput={(e) => setDraft(e.currentTarget.value)} onKeyDown={(e) => { + if (e.key === "Escape") { + setCommenting(null) + return + } if (e.key !== "Enter") return if (e.shiftKey) return e.preventDefault() |
