Check for 'N' in save dialog even if focus is on a button

Fixes #4109. Also fixed a bug in `_hasButton` that was hidden by the fact that this wasn't working :)

Note that the other use of `inFormField` should stay because we want to allow the TAB key to work for non-text-fields. (It's not clear whether we should be stopping other keys, though.)