I have an listener which does some action when a mousenter event happens and ctrl key is pressed. so e.g
somenode.addEventListener(events.EventType.MOUSEENTER, event => {
if (event.ctrlKey) {
// do action_1
}
});
I also have to do some other action when the ctrl key is released. so e.g
document.addEventListener('keyup', (e) => {
if (e.keyCode == KeyCodes.CTRL) {
// do action_2
}
});
this works fine. The problem happens when lets say i open chrome console, the document losses focus. Now when the user points back the mouse over to the page somehow the mouseenter event still happens (even when page is not in foucs) however if they release the ctrl key i do not get that call back (possibly because the page is not in focus).
This kinds of break the flow as i am only able to do action_1 . Is there a way i can figure out when the ctrl key is released so that i can also perform action_2 ?