moved event.preventDefault inside if-then structure

I moved the event.preventDefault to inside the if-then structure, so that other key commands will still work. It is necessary for the Tab key to get passed to the browser so a keyboard-only user can navigate through this UI element. If the Tab key is prevented, a keyboard-only user has no way of leaving the UI element once they are in it.