Adding listeners for the arrow keys and the enter key.