Pulled $userEvent out of 'if' branches