Defensive check around e.preventDefault in onFocus

Fixes #178