Fixes #6467: ActiveForm will scroll to the nearest visible element when the first error input is hidden

This commit is contained in:
Qiang Xue
2014-12-13 19:53:18 -05:00
parent f0d7a52d84
commit fa0a3aefae
2 changed files with 2 additions and 1 deletions

View File

@ -487,7 +487,7 @@
updateSummary($form, messages);
if (errorInputs.length) {
var top = $form.find(errorInputs.join(',')).first().offset().top;
var top = $form.find(errorInputs.join(',')).first().closest(':visible').offset().top;
var wtop = $(window).scrollTop();
if (top < wtop || top > wtop + $(window).height) {
$(window).scrollTop(top);