Hello,
I am trying to add a row of buttons on top of on-screen keyboard.
The app is a smart calculator app where users can type expressions to get answers.
I added a dispatch event like
document.addEventListener("keydown", (e) => {
console.log(e);
});
function pressKey(key: string) {
document.dispatchEvent(
new KeyboardEvent("keydown", {
key,
})
);
I can actually see the event being fired but isTrusted is false for obvious reason. Thus how do I allows this functionality in proper way? is there official way to have such a button and allow trusted keypresses?
Thanks.