Changed key event handling to prevent default browser actions.