Preserve local focus when document focus is lost to prevent the key responder stack from getting out of sync