Fix error when navigating past end of tags

When using the arrow key to select tags, if you arrow past the last or
first tag a javascript error occurs "Uncaught TypeError: Cannot read
property 'target' of undefined "