Skip to content

Commit

Permalink
unbreak automatic focusing of invalid field in phone home setup
Browse files Browse the repository at this point in the history
In addition to fixing it we're trying not to focus first invalid
element if another invalid element is already focused. This sadly,
doesn't work on IE8, seemingly because at form submit time focus is
already on next button.

Change-Id: I38d11934817a6a41fdc361e5822f03158959ed8e
Reviewed-on: http://review.couchbase.org/11793
Reviewed-by: Steve Yen <steve.yen@gmail.com>
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
  • Loading branch information
Aliaksey Kandratsenka authored and alk committed Dec 22, 2011
1 parent d2e752d commit 64ed139
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion priv/public/js/app.js
Expand Up @@ -756,9 +756,12 @@ var NodeDialog = {
}

if (errors.length) {
var invalidFields = dialog.find('.invalid');
renderTemplate('update_notifications_errors', errors);
$('#update_notifications_errors_container').show();
try {invalidFields[0].focus();} catch (e) {}
if (invalidFields.length && !_.include(invalidFields, document.activeElement)) {
setTimeout(function () {try {invalidFields[0].focus();} catch (e) {}}, 10);
}
return;
}

Expand Down

0 comments on commit 64ed139

Please sign in to comment.