Focus Mac OS X dialog with keyboard

Found an answer to a long standing Mac OS keyboard navigation question: How to focus a dialog window when it has lost focus. I often prefer to use my keyboard for performing my computing tasks. It happens from time to time that a dialog pops up and doesn’t have keyboard focus (can happen, for instance, when switching applications just when it pops up). It has been frustrating that I haven’t been able to get focus to it without using the mouse / trackpad. The solution isn’t ideal, as it requires enabling Voiceover (or it can also be done with mouse keys), but it works. Voiceover has a window chooser that can access the dialog. Since I don’t have Voiceover enabled normally, the procedure is basically:

  1. cmd-f5 (enable Voiceover)
  2. ctl-opt-f2+f2 (hit f2 twice, opens window chooser)
  3. [up / down arrow to dialog]
  4. return
  5. [tab + space / return to operate dialog]
  6. cmd-f5 (disable Voiceover)