goog.events.listen key-press event
Posted: Fri Aug 04, 2017 9:24 pm
Hello,
I'm trying to stop the propagation of the key-press event for the delete key by using the code below in the framework.js file.The delete key fails to stop propagating. Am I listening at the correct eventSource as in goog.events.listen(eventSource, eventType, listener, [capturePhase, [handler]]); for this action?
Any thoughts would be appreciated.
Thanks!
John
I'm trying to stop the propagation of the key-press event for the delete key by using the code below in the framework.js file.
Code: Select all
goog.events.listen(goog.dom.getDocument(), goog.events.EventType.KEYDOWN, function(e) {
if(e.keyCode == goog.events.KeyCodes.DELETE){
//do stuff...
e.getBrowserEvent().preventDefault();
e.getBrowserEvent().stopPropagation();
}
});
Any thoughts would be appreciated.
Thanks!
John