Soundorv0.13.0

user.keyboard

Presses keys: characters, named keys, held modifiers, physical keys.

await user.keyboard(keys: string): Promise<void>;

Presses and releases keys on the focused node, in order. Characters are typed as they are; named and held keys are written in braces.

await user.keyboard('{ArrowUp}'); // one key
await user.keyboard('{Shift>}{ArrowUp}{/Shift}'); // Shift held around ArrowUp
await user.keyboard('{Control>}a{/Control}{Backspace}'); // select all, delete
await user.keyboard('[KeyA]'); // a physical key, by its code
await user.keyboard('{{'); // a literal {
WrittenWhat it presses
aThe key for that character, down and up.
{Enter}A named key (Enter, Tab, Escape, ArrowUp, Backspace, …).
{Shift>}Holds the key down, until {/Shift} releases it.
[KeyA]A physical key, by its code (KeyA, Digit1).
{{, [[A literal { or [.

Good to know

  • Keys go to the focused node: focus it first, with click or tab.
  • Default actions follow: Tab moves focus, Enter presses a focused button, a text input edits itself (unless a listener prevents it).
  • Soundor's editing rules, not a keyboard layout or an input method: what is typed is the character written.

On this page