From afa36e71f83a4e2f72d86e315ad97de7bd061d22 Mon Sep 17 00:00:00 2001 From: Alexander Skvortsov <38059171+askvortsov1@users.noreply.github.com> Date: Mon, 27 Dec 2021 18:13:29 -0500 Subject: [PATCH] Only retain scroll position if coming from discussion (#3229) Fixes https://discuss.flarum.org/d/29596-make-tag-hero-visible/8. If a user has just switched from one tag to another, they want to see the entire new discussion list, and information about which tag that discussion list corresponds to. There's no good reason to not display the hero header when switching tags. --- framework/core/js/src/forum/components/IndexPage.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/framework/core/js/src/forum/components/IndexPage.js b/framework/core/js/src/forum/components/IndexPage.js index 3d79eb5ed..a9bd9f345 100644 --- a/framework/core/js/src/forum/components/IndexPage.js +++ b/framework/core/js/src/forum/components/IndexPage.js @@ -89,9 +89,9 @@ export default class IndexPage extends Page { // Let browser handle scrolling on page reload. if (app.previous.type == null) return; - // When on mobile, only retain scroll if we're coming from a discussion page. + // Only retain scroll position if we're coming from a discussion page. // Otherwise, we've just changed the filter, so we should go to the top of the page. - if (app.screen() == 'desktop' || app.screen() == 'desktop-hd' || this.lastDiscussion) { + if (this.lastDiscussion) { $(window).scrollTop(scrollTop - oldHeroHeight + heroHeight); } else { $(window).scrollTop(0);