It would be simpler to just use &&:

   var autoCorrection = needsCandidatePanel() && correctionsEnabled