Blur active field before submit validation

This commit is contained in:
J. Ryan Stinnett 2019-04-25 11:27:03 +01:00
parent 26f732723e
commit af17829229

View file

@ -128,6 +128,13 @@ module.exports = React.createClass({
}, },
async verifyFieldsBeforeSubmit() { async verifyFieldsBeforeSubmit() {
// Blur the active element if any, so we first run its blur validation,
// which is less strict than the pass we're about to do below for all fields.
const activeElement = document.activeElement;
if (activeElement) {
activeElement.blur();
}
const fieldIDsInDisplayOrder = [ const fieldIDsInDisplayOrder = [
FIELD_USERNAME, FIELD_USERNAME,
FIELD_PASSWORD, FIELD_PASSWORD,