top & bottom arrow keypress handling