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

@ -5,6 +5,7 @@ Yii Framework 2 Change Log
-----------------------
- Bug #6404: advanced application template `Alert` widget was generating duplicate IDs in case of multiple flashes (SDKiller)
- Enh #6467: `ActiveForm` will scroll to the nearest visible element when the first error input is hidden (newartix)
2.0.1 December 07, 2014

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);