Skip to content

Commit aff30ba

Browse files
Form renderer: scroll to top of section on next/previous
1 parent 73f0b4a commit aff30ba

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

css/includes/components/form/_form-renderer.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,4 +151,8 @@
151151
top: unset;
152152
}
153153
}
154+
155+
[data-glpi-form-renderer-section] {
156+
scroll-margin-top: 72px; // Height of sticky header + 16px
157+
}
154158
}

js/modules/Forms/RendererController.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,9 @@ export class GlpiFormRendererController
353353

354354
// Update actions visibility
355355
this.#updateActionsVisiblity();
356+
357+
// Scroll to the top of the section
358+
$('[data-glpi-form-renderer-section]:visible')[0].scrollIntoView();
356359
}
357360

358361
/**
@@ -388,6 +391,9 @@ export class GlpiFormRendererController
388391

389392
// Update actions visibility
390393
this.#updateActionsVisiblity();
394+
395+
// Scroll to the top of the section
396+
$('[data-glpi-form-renderer-section]:visible')[0].scrollIntoView();
391397
}
392398

393399
/**

0 commit comments

Comments
 (0)