feat(ui): Escape key to stop generation in Chat tab

Press Escape while generation is running to stop it (same as clicking Stop).
Also shows 'Esc' keyboard hint on the Stop button.

Changes:
- ui/src/ui/views/chat.ts: Add keydown handler for Escape, show kbd hint
This commit is contained in:
Clawdbot 2026-01-28 15:42:01 +01:00
parent 01e0d3a320
commit b89554b081

View File

@ -240,7 +240,16 @@ export function renderChat(props: ChatProps) {
`;
return html`
<section class="card chat">
<section
class="card chat"
tabindex="-1"
@keydown=${(e: KeyboardEvent) => {
if (e.key === "Escape" && canAbort && props.onAbort) {
e.preventDefault();
props.onAbort();
}
}}
>
${props.disabledReason
? html`<div class="callout">${props.disabledReason}</div>`
: nothing}
@ -359,7 +368,9 @@ export function renderChat(props: ChatProps) {
?disabled=${!props.connected || (!canAbort && props.sending)}
@click=${canAbort ? props.onAbort : props.onNewSession}
>
${canAbort ? "Stop" : "New session"}
${canAbort ? "Stop" : "New session"}${canAbort
? html`<kbd class="btn-kbd">Esc</kbd>`
: nothing}
</button>
<button
class="btn primary"