-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Labels
Description
The KeyboardHelper may brake site functionality because it add/remove document keyboard event listeners using event handlers properties. If the parent site has already some event listeners added in the same manner they are removed by this code and the site functionality is damaged.
GrabKeyInput (): any {
if (this.KeyInputGrab) { return }
document.onkeyup = this.handleKeyUp.bind(this)
document.onkeydown = this.handleKeyDown.bind(this)
document.onkeypress = this.handleKeys.bind(this)
this.KeyInputGrab = true
}
UnGrabKeyInput (): any {
if (!this.KeyInputGrab) { return }
document.onkeyup = null
document.onkeydown = null
document.onkeypress = null
this.KeyInputGrab = false
}
Using addEventListener/removeEventListener would be better, to preserve any previous event handlers.
constructor ()
this.handleKeyUp = this.handleKeyUp.bind(this)
GrabKeyInput
document.addEventListener('keyup', this.handleKeyUp)
UnGrabKeyInput
document.removeEventListener('keyup', this.handleKeyUp)
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Todo
Status
Q1 2026