Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't work for different keyboard combinations #140

Open
CheckMater opened this issue Mar 5, 2020 · 1 comment
Open

Doesn't work for different keyboard combinations #140

CheckMater opened this issue Mar 5, 2020 · 1 comment

Comments

@CheckMater
Copy link

CheckMater commented Mar 5, 2020

Looks like it doesn't work if I for example use the Alt + 64 combination for the "@" character but it works if I add it using other combination or a key to insert it directly.

@CheckMater CheckMater changed the title Doesn't work at all Doesn't work for different keyboard combinations Mar 5, 2020
@erickvalderrama
Copy link

erickvalderrama commented Mar 14, 2022

Hi, this worked to me, detecting with keypress and triggering a KeyboardEventInit:

onKeypress(event:any) { var element = document.getElementById("commentMentions"); if(element&&event&&event["key"]=='@'&&event["code"]!="Digit2"){ let eventInit:KeyboardEventInit = {}; eventInit.composed = true; eventInit.bubbles = true; eventInit.cancelable = true; eventInit.code = "Digit2"; eventInit.ctrlKey = true; eventInit.key = '@'; eventInit.location = 0; element.dispatchEvent(new KeyboardEvent('keydown',eventInit)); } }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants