bitovi / syn

Standalone Synthetic Event Library
https://www.npmjs.com/package/syn
MIT License
444 stars 258 forks source link

keyCode is not mapped correctly when capital character is given #195

Open mvorisek opened 2 years ago

mvorisek commented 2 years ago

image

v0.15.0 / latest

Firefox native behaviour:

image

key is capitalized according to the active shift, thus such capitalized/UC character must be supported by syn.js

test case:

['keypress', 'keydown', 'keyup'].forEach((k) => $('#xxx')[0].addEventListener(k, event => { console.log(event); }));
syn.trigger($('#xxx')[0], 'keyup', {character: 'n'});
syn.trigger($('#xxx')[0], 'keyup', {character: 'N', shiftKey: true});

must log both events with non-zero keyCode