Reproduction example
https://codesandbox.io/p/sandbox/festive-rhodes-5mpcfy?file=%2Fsrc%2FApp.js%3A11%2C27
Prerequisites
- Create a test with an
onKeyDown event handler (e.g. with an <input onKeyDown={(e) => console.log(e.code)} /> element)
- Create a test w/
userEvent.type(inputElement, ']');
Expected behavior
The KeyboardEvent.code value ought to be 'BracketRight' same as if it were done in a browser (tested in chrome 125)
Actual behavior
The KeyboardEvent.code value is 'Unknown' per this fallback logic:
User-event version
14.5.1
Environment
Testing Library framework:
JS framework:
Test environment:
DOM implementation:
Additional context
I imagine the fix is a relatively simple addition to https://github.com/testing-library/user-event/blob/main/src/keyboard/keyMap.ts, but perhaps I'm missing some context
Reproduction example
https://codesandbox.io/p/sandbox/festive-rhodes-5mpcfy?file=%2Fsrc%2FApp.js%3A11%2C27
Prerequisites
onKeyDownevent handler (e.g. with an<input onKeyDown={(e) => console.log(e.code)} />element)userEvent.type(inputElement, ']');Expected behavior
The
KeyboardEvent.codevalue ought to be'BracketRight'same as if it were done in a browser (tested in chrome 125)Actual behavior
The
KeyboardEvent.codevalue is'Unknown'per this fallback logic:user-event/src/keyboard/parseKeyDef.ts
Line 41 in d036279
User-event version
14.5.1
Environment
Testing Library framework:
JS framework:
Test environment:
DOM implementation:
Additional context
I imagine the fix is a relatively simple addition to https://github.com/testing-library/user-event/blob/main/src/keyboard/keyMap.ts, but perhaps I'm missing some context