fix(tui): 初始化时自动聚焦 textarea
根因: OpenTUI textarea 即使 focused=true 也不会自动获取键盘焦点, 需要显式调用 textarea.focus()。onMount 后延迟 50ms 聚焦, 确保 textarea 挂载完成后 Enter 键可触发 onsubmit。 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -254,6 +254,11 @@ function AirCodingView(props: {
|
|||||||
let pasteTick: ReturnType<typeof setTimeout> | undefined
|
let pasteTick: ReturnType<typeof setTimeout> | undefined
|
||||||
let exitConfirmUntil = 0
|
let exitConfirmUntil = 0
|
||||||
|
|
||||||
|
onMount(() => {
|
||||||
|
// Give the textarea time to mount before focusing
|
||||||
|
setTimeout(() => focusPrompt(), 50)
|
||||||
|
})
|
||||||
|
|
||||||
props.bindState({
|
props.bindState({
|
||||||
setProjection,
|
setProjection,
|
||||||
setView: setActiveView,
|
setView: setActiveView,
|
||||||
|
|||||||
Reference in New Issue
Block a user