Don't directly replace the key event function, instead add a handler.