adding js functionality for the arrow key navigation