1
0
mirror of https://github.com/flarum/core.git synced 2025-07-26 11:10:41 +02:00

Page Scroll Cleanup (#2396)

- Reintroduce cancellable scroll top on page change
- IndexPage: rely on browser to retain scroll position on page reload
- Remove obsolete browser hack
- Fix broken selector
- When on mobile, only retain scroll for IndexPage if we're coming from a discussion
- Move app.cache.scrollTop save into `onbeforeremove` so we make sure to do it before DOM is detached
This commit is contained in:
Alexander Skvortsov
2020-10-17 13:42:33 -04:00
committed by GitHub
parent d53eeded44
commit 1936b9117d
2 changed files with 29 additions and 11 deletions

View File

@@ -22,6 +22,13 @@ export default class Page extends Component {
* @type {String}
*/
this.bodyClass = '';
/**
* Whether we should scroll to the top of the page when its rendered.
*
* @type {Boolean}
*/
this.scrollTopOnCreate = true;
}
oncreate(vnode) {
@@ -30,6 +37,10 @@ export default class Page extends Component {
if (this.bodyClass) {
$('#app').addClass(this.bodyClass);
}
if (this.scrollTopOnCreate) {
$(window).scrollTop(0);
}
}
onremove() {