fix: make key presses visible in video — hold + subtitle

pressKey now uses keyboard.down/up with 400ms hold instead of
instant press(). Shows subtitle "⌨ Escape" and the keyboard HUD
catches the held state for video frame capture.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
snomiao
2026-03-27 08:33:22 +00:00
parent 0984ec2706
commit 00dc89dad7

View File

@@ -762,7 +762,17 @@ export async function executeAction(
break
case 'pressKey':
try {
await page.keyboard.press(step.key)
// Show key press in subtitle + hold long enough for video frame capture
const keyLabel =
step.key === ' '
? 'Space'
: step.key.length === 1
? step.key.toUpperCase()
: step.key
await showSubtitle(page, `${keyLabel}`, 0)
await page.keyboard.down(step.key)
await sleep(400) // Hold long enough for HUD + video frame
await page.keyboard.up(step.key)
await sleep(300)
} catch (e) {
console.warn(