Push browser history when navigating within a topic

If this has already been suggested, please direct me to an existing discussion.


On Discourse, clicking links to other topics within Discourse adds to the browser history, allowing you to use the browser back button (or equivalent) to go back to the previous topic. However, when a link navigates to another post within the same topic, this does not happen. This results in the back button going to the previous topic instead of the previous post.

Sometimes direct links are posted to previous discussions within a topic (or even later discussions in the case of a wiki), but this also happens when clicking the little arrows in Discourse for going to a quoted / replied-to post. I would like to request that click those arrows or any other link that navigates within the same topic push to the browser history, so that clicking the browser back button (or equivalent) goes back to the previous post you were viewing.


Arrows I was referencing in case it wasn’t clear:
image

1 Like

This is by design, conceptually each topic is a single page. Scrolling up or down in a large page is not navigating to a new page.

Additionally your furthest read post is always tracked. So if you scroll up (or teleport up via internal topic link) on a page, you can always use the on-screen Discourse provided back button on the vertical timeline to go back to your latest / furthest read position.

Does that back button always show up? I just tried clicking the “reply” user icon on mobile to go to a previous post within a topic and it never showed up. Also, personally it’s not always desirable to go all the way to your furthest read position. Sometimes I post a reply to a topic, which Discourse takes to mean that’s my furthest read position. At that point, going to catch up on stuff I missed becomes more difficult because the Discourse “Back” button sends you to the end instead of to what you’re currently catching up on.

Also, perhaps it’s a small use case, but I run into this a lot in topics that have a lot of collaboration (specifically book club discussions in my case). Here’s an example:

  • Topic has several hundred posts from ongoing discussion
  • First post links to several book nominations, all scattered within the same topic (since people just post as they want to nominate something)
  • You want to see the first nomination, so you click the first link. However, now you can’t just hit the browser back button to go click the second nomination’s link.

Anyway, I just wanted to give a more concrete examples of my use cases.

1 Like

Is there any chance something like this could become a user setting?

Yes this shows up always but you have to be a few posts up to see it and have last unread that is smaller than the last reply to the topic.

Catching up on “reading holes” is something we have thought about over the years but do not have a perfect solution on offer yet.

3 Likes

I for one still sometimes want something like this, and I think it has to do with parity of how html anchor tags work: scrolling around won’t affect your history, but navigating to links within the same page jumps and adds to the browser history.

4 Likes

I am really quite strongly opposed, because I feel “anchor tags” is an obsolete method of navigation – especially on a page that has a vertical timeline on it dedicated to the function of navigating up and down in time on that topic. All you’d be doing is breaking the back button when someone decides

I pressed the back button and I went back to the previous topic (or topic list)

now instead they’ll get

I pressed the back button and I was randomly teleported to a random place on the same page :question:

You have traded “marginally better in some rare cases that were already handled by the vertical timeline” for “totally breaking the back button” :frowning:

I’m just gonna close this because I view it as a complete non-starter.