Change event handler registration

Change event handler registration to addEventListener instead of using deprecated overriding of onKeydown, etc. This also fixes the issues where the app was not getting keypress callbacks.