dispatchKeyEvent `text` parameter should cause Input event to be synthesized
Categories
(Remote Protocol :: CDP, enhancement, P3)
Tracking
(Not tracked)
People
(Reporter: impossibus, Unassigned)
References
(Blocks 1 open bug)
Details
In order to support the text
parameter, we need to synthesize an Input event independently of KeyboardEvents. In other words, the value text
is what should show up in an input field, regardless of what value is provided by KeyboardEvent.key.
In puppeteer running with Chrome:
await page.keyboard.down("KeyA", {"text": "L"});
await page.keyboard.up("KeyA");
The corresponds to CDP commands: (note that "text" is L)
{"method":"Input.dispatchKeyEvent","params":{"type":"keyDown","modifiers":0,"windowsVirtualKeyCode":65,"code":"KeyA","key":"a","text":"L","unmodifiedText":"L","autoRepeat":false,"location":0,"isKeypad":false}}
{"method":"Input.dispatchKeyEvent","params":{"type":"keyUp","modifiers":0,"key":"a","windowsVirtualKeyCode":65,"code":"KeyA","location":0}}
keyboard events: note that the keyboard event has 'a', but the input event has 'L' and 'L' is displayed in the input element.
[ { code: 'KeyA',
key: 'a',
which: 65,
location: 0,
ctrl: false,
meta: false,
shift: false,
repeat: false,
type: 'keydown' },
{ code: 'KeyA',
key: 'a',
which: 76,
location: 0,
ctrl: false,
meta: false,
shift: false,
repeat: false,
type: 'keypress' },
{ data: 'L', inputType: 'insertText', isComposing: false },
{ code: 'KeyA',
key: 'a',
which: 65,
location: 0,
ctrl: false,
meta: false,
shift: false,
repeat: false,
type: 'keyup' } ]
Reporter | ||
Comment 1•5 years ago
|
||
As far as I can tell, there's no way to synthesize a trusted Input event via EventUtils or TextInputProcessor such that it represents different text data than the corresponding KeyboardEvents.
Updated•5 years ago
|
Updated•5 years ago
|
Reporter | ||
Comment 2•5 years ago
|
||
This isn't used in the gutenberg test suite and is a relatively esoteric use-case so I don't think it needs to be in alpha.
Updated•5 years ago
|
Assignee | ||
Updated•4 years ago
|
Updated•2 years ago
|
Description
•