Commit fa0a3aef by Qiang Xue

Fixes #6467: `ActiveForm` will scroll to the nearest visible element when the…

Fixes #6467: `ActiveForm` will scroll to the nearest visible element when the first error input is hidden
parent f0d7a52d
...@@ -5,6 +5,7 @@ Yii Framework 2 Change Log ...@@ -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) - 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 2.0.1 December 07, 2014
......
...@@ -487,7 +487,7 @@ ...@@ -487,7 +487,7 @@
updateSummary($form, messages); updateSummary($form, messages);
if (errorInputs.length) { 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(); var wtop = $(window).scrollTop();
if (top < wtop || top > wtop + $(window).height) { if (top < wtop || top > wtop + $(window).height) {
$(window).scrollTop(top); $(window).scrollTop(top);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment