fix(tui): consume Enter in dialog useKeyboard handlers (#23390)
This commit is contained in:
@@ -77,6 +77,8 @@ export function DialogGoUpsell(props: DialogGoUpsellProps) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (evt.name === "return") {
|
if (evt.name === "return") {
|
||||||
|
evt.preventDefault()
|
||||||
|
evt.stopPropagation()
|
||||||
if (selected() === "subscribe") subscribe(props, dialog)
|
if (selected() === "subscribe") subscribe(props, dialog)
|
||||||
else dismiss(props, dialog)
|
else dismiss(props, dialog)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,6 +42,8 @@ export function DialogSessionDeleteFailed(props: {
|
|||||||
|
|
||||||
useKeyboard((evt) => {
|
useKeyboard((evt) => {
|
||||||
if (evt.name === "return") {
|
if (evt.name === "return") {
|
||||||
|
evt.preventDefault()
|
||||||
|
evt.stopPropagation()
|
||||||
void confirm()
|
void confirm()
|
||||||
}
|
}
|
||||||
if (evt.name === "left" || evt.name === "up") {
|
if (evt.name === "left" || evt.name === "up") {
|
||||||
|
|||||||
@@ -15,6 +15,8 @@ export function DialogAlert(props: DialogAlertProps) {
|
|||||||
|
|
||||||
useKeyboard((evt) => {
|
useKeyboard((evt) => {
|
||||||
if (evt.name === "return") {
|
if (evt.name === "return") {
|
||||||
|
evt.preventDefault()
|
||||||
|
evt.stopPropagation()
|
||||||
props.onConfirm?.()
|
props.onConfirm?.()
|
||||||
dialog.clear()
|
dialog.clear()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,6 +25,8 @@ export function DialogConfirm(props: DialogConfirmProps) {
|
|||||||
|
|
||||||
useKeyboard((evt) => {
|
useKeyboard((evt) => {
|
||||||
if (evt.name === "return") {
|
if (evt.name === "return") {
|
||||||
|
evt.preventDefault()
|
||||||
|
evt.stopPropagation()
|
||||||
if (store.active === "confirm") props.onConfirm?.()
|
if (store.active === "confirm") props.onConfirm?.()
|
||||||
if (store.active === "cancel") props.onCancel?.()
|
if (store.active === "cancel") props.onCancel?.()
|
||||||
dialog.clear()
|
dialog.clear()
|
||||||
|
|||||||
@@ -35,6 +35,8 @@ export function DialogExportOptions(props: DialogExportOptionsProps) {
|
|||||||
|
|
||||||
useKeyboard((evt) => {
|
useKeyboard((evt) => {
|
||||||
if (evt.name === "return") {
|
if (evt.name === "return") {
|
||||||
|
evt.preventDefault()
|
||||||
|
evt.stopPropagation()
|
||||||
props.onConfirm?.({
|
props.onConfirm?.({
|
||||||
filename: textarea.plainText,
|
filename: textarea.plainText,
|
||||||
thinking: store.thinking,
|
thinking: store.thinking,
|
||||||
|
|||||||
@@ -11,6 +11,8 @@ export function DialogHelp() {
|
|||||||
|
|
||||||
useKeyboard((evt) => {
|
useKeyboard((evt) => {
|
||||||
if (evt.name === "return" || evt.name === "escape") {
|
if (evt.name === "return" || evt.name === "escape") {
|
||||||
|
evt.preventDefault()
|
||||||
|
evt.stopPropagation()
|
||||||
dialog.clear()
|
dialog.clear()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -29,6 +29,8 @@ export function DialogPrompt(props: DialogPromptProps) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (evt.name === "return") {
|
if (evt.name === "return") {
|
||||||
|
evt.preventDefault()
|
||||||
|
evt.stopPropagation()
|
||||||
props.onConfirm?.(textarea.plainText)
|
props.onConfirm?.(textarea.plainText)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user