fix(composer): keep first focus on the expert menu when opening options

48d7526 widened the options dialog first-focus selector to inputs, so the new story graph switch above the menus took initial focus. Keyboard users no longer landed on the expert / work mode menus like the model picker. Restore the button-only target; the switch stays reachable with Tab.
This commit is contained in:
mesalogo
2026-10-03 20:04:55 +08:00
parent 942fe3206c
commit 2adee13638
2 changed files with 5 additions and 2 deletions
+2 -1
View File
@@ -66,7 +66,8 @@ app.whenReady().then(async () => {
const point = await js<{ x: number; y: number }>(`(() => { const r = document.querySelector('.composer__options-trigger').getBoundingClientRect(); return { x: Math.round(r.x+r.width/2), y: Math.round(r.y+r.height/2) }; })()`)
win.webContents.sendInputEvent({ type: 'mouseDown', ...point, button: 'left', clickCount: 1 })
win.webContents.sendInputEvent({ type: 'mouseUp', ...point, button: 'left', clickCount: 1 })
await wait(`document.activeElement === document.querySelector('${toggle}')`)
// First focus stays on the first menu button, matching the model picker.
await wait('document.activeElement === document.querySelector(".composer__options button:not(:disabled)")')
}
const scenarios: object[] = []
try {