Implement keyboard events.