Skip to content

Commit e12e41a

Browse files
committed
Automatic scrolling to the first element after page change
1 parent 3aec309 commit e12e41a

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

ts/WoltLabSuite/Core/Component/ListView.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import State, { StateChangeCause } from "./ListView/State";
22
import { trigger as triggerDomChange } from "../Dom/Change/Listener";
33
import { setInnerHtml } from "../Dom/Util";
44
import { getItems } from "../Api/ListViews/GetItems";
5+
import { element as scrollToElement } from "WoltLabSuite/Core/Ui/Scroll";
56

67
export class ListView {
78
readonly #viewClassName: string;
@@ -52,6 +53,9 @@ export class ListView {
5253
this.#viewElement.hidden = response.totalItems === 0;
5354
this.#noItemsNotice.hidden = response.totalItems !== 0;
5455
this.#state.updateFromResponse(cause, response.pages, response.filterLabels);
56+
if (cause === StateChangeCause.Pagination) {
57+
scrollToElement(this.#viewElement);
58+
}
5559

5660
triggerDomChange();
5761
}

wcfsetup/install/files/js/WoltLabSuite/Core/Component/ListView.js

Lines changed: 4 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)