Preserve local focus when document focus is lost

This prevents the key responder stack from getting out of sync