#2192

`keyboard type` / `type` send no key events to a focused canvas, and `press Control+l` skips the Control keydown

Openkassamkhojaopened 8d ago

What happens

On a focused <canvas> (for example a noVNC remote desktop), keyboard type and type <selector> report ✓ Done but dispatch no DOM key events, so the canvas app receives nothing. press Control+l dispatches l with ctrlKey: true but no keydown for Control itself, so apps that track modifier state from key events (noVNC forwards each keydown/keyup to the remote machine) see a bare l. A single press a works.

Steps to reproduce

agent-browser open 'data:text/html,<canvas id=c tabindex=0 width=300 height=150></canvas><script>window.log=[];const c=document.getElementById("c");for(const t of ["keydown","keyup","keypress"])c.addEventListener(t,e=>log.push(t+":"+e.key+(e.ctrlKey?"+ctrl":"")));c.focus()</script>'
agent-browser keyboard type ab
agent-browser eval 'JSON.stringify(log.splice(0))'   # "[]"
agent-browser type '#c' ab
agent-browser eval 'JSON.stringify(log.splice(0))'   # "[]"
agent-browser eval 'document.getElementById("c").focus()'
agent-browser press Control+l
agent-browser eval 'JSON.stringify(log.splice(0))'   # ["keydown:l+ctrl","keyup:l+ctrl"]
agent-browser press a
agent-browser eval 'JSON.stringify(log.splice(0))'   # ["keydown:a","keypress:a","keyup:a"]

Expected

  • keyboard type / type on a non-editable focused element send real keydown / keypress / keyup per character (as Playwright's keyboard.type does), or fail loudly instead of reporting success.
  • press Control+l sends keydown Control, keydown l, keyup l, keyup Control, like Playwright's keyboard.press('Control+l'). With a Playwright keyboard sequence, the same noVNC page receives the Control modifier correctly.

Environment

Linux, Chrome engine, agent-browser 0.37.0. I didn't find a keyboard change in the release notes through 0.39.1.

Related but different: #2055 (type on a non-text element writes into the previously focused field), #2102 (held modifiers don't reach later mouse commands).

Activity

0

No activity yet.