Good way to "Go back" feature after hitting "jump to the quoted post"?

(Jeff Wong) #1

One of the things I’m finding in my day to day use of discourse is when navigating across quotes is that I feel like I will lose my place if I hit a “jump to quoted post” button, so I tend to avoid it. I think I’d use it much more to get context if I could get back to where I was previously.

If the quoted post is not in direct reply to the post, there is no easy way to get back to where I was pre-jump, as it doesn’t show up in the “n replies” links. I don’t see any indication on the post I jumped to to bring me back. Something like the “back” mark on the timeline might be a good indicator of what I’d like. Using u is not saving history in the jump.

Is there an easy way to jump backwards through posts and get a breadtrail to return through that I’m missing? Should I be using my bookmarks for this? Would it be up for discussion to save history so the back button/shortcut can return me down in-topic links?

(Jeff Atwood) #2

Ummmmmm this is exactly why the back button exists on the vertical timeline? Granted it will not work when you jump down (forward to newer posts) but it works fine when jumping up (backward to older posts).

(Jeff Wong) #3

To clarify, assume that I already have marked the posts as read. The back button on the timeline only works the first time around. When I’m re-reading a previous post, I don’t have the same experience.

(Jeff Atwood) #4

Maybe you want a way to un-mark the topic as read, then?

(Jeff Wong) #5

That could work for this, though I’m not sure it would be in line with the calculations for # of posts read, or read time, and badges dependent on tracking read/write times. I just wanted to bring up my experiences with it to your attention.

I suppose what it really comes down to is I really like having the ‘go back’ button when I go upwards. I’d like more, given the use cases for jumping upwards in topic links along read posts. Think vim markers and emacs mark rings.

(Nicolas Évrard) #6

Should it work even on mobile? I just tested it on a forum we migrated from IPB yesterday and I don’t see the sidebar back button that I usually see when I scroll upwards.

I should add that I am using an android phone ; someone using an iPhone on my forum has the “Back” button. So it’s probably a bug specific to my platform (how can I report it?).

(Jeff Atwood) #7

Yes, it works, provided your current read position is not at the absolute bottom.

(Nicolas Évrard) #8

OK, what does “current read position” mean? I am maybe missing something here.

Because, on my mobile phone (android using the discourse app thus Chrome) it doesn’t work. On my desktop (using Firefox), it doesn’t either.

EDIT: OK I checked again and this time it works … there must be something I don’t understand.

(Jeff Atwood) #9

Enter a topic you have not entered before, scroll down a bit, then back up.

Enter a topic you have entered before, but have a read position somewhere in the middle (not at the bottom), scroll down a bit, then back up.

Like I said it works everywhere provided your read position in the topic is not at the bottom.

(Joshua Rosenfeld) #10

To try and help clarify this (because I also had a hard time understanding it initially), I’m going to use some numbers to try and help. (Note, numbers are just for show)

Let’s say we have 3 topics, A, B, and C.

  • A: This topic has 9 posts, you’ve read the entire topic (all 9 posts).
  • B: This topic has 12 posts, you’ve never entered or read the topic before.
  • C: This topic also has 12 posts, you’ve read the first 6 posts.

Now, here’s how to make the back button appear:

  • A: The back button will never appear as you’ve read all the posts (thus your reading position is at the bottom).
  • B: Enter the topic and read up to 11 posts, then scroll up. After scrolling up a few posts you will see the back button link to the last (lowest/most recent) post you’ve read.
  • C: Enter the topic - you’ll start at post 7 (the first post you haven’t read). Read down a few posts, but not past post 11, then scroll up. After scrolling up a few posts you will see the back button link to the last (lowest/most recent) post you’ve read.

Hope this helps!

(Nicolas Évrard) #11

OK I got it thanks. But this is quite different from the description of the title.

From my understanding what the OP means is that even if you’ve read the whole topic, if for what ever reason you hit the “jump to the quoted post” button then the back button should bring you back to where you come from.

(Joshua Rosenfeld) #12

That would indeed be convenient, but it isn’t what the back button currently does. I like it as a potential expansion!

(Jeff Atwood) #13

That doesn’t make any sense. If you have read to the bottom you have already read every post, so what difference does it make if you “lose your place?”

This is like you handing me a Harry Potter book that I’ve already read. It does not matter where the bookmark (back) is, because I’ve already read the entire book anyway. There is no concept of being at a certain “place” in the book. I’m done. I’ve finished.

(Jeff Wong) #14

To clarify the original request: Harry Potter is a good series of books - maybe I’d like to re-read one again. During my read, I’d like to save my current place, find a reference, and ‘go back’ to where I was in the current readthrough, regardless of how many times I’ve read it before.

As stated in the original post, bookmarks could work for this use case, but aren’t as simple as the ‘go back’ functionality, as a bookmark won’t auto-update on scroll.

(Nicolas Évrard) #15

In my community people re-read old posts that for a reason or another they liked. Just yesterday I was surprised that someone knew that by going back to June 2009 almost anywhere in a specific topic he would find interesting or funny posts. Then he stumbles upon a post would like to see what post it is replying to and after this small interruption continue from where he came from.

Also sometimes people bookmark posts that they would like to respond to and they keep reading up to the end. When they go back to the bookmarked post and then to the parent they miss the back button.

(Jeff Atwood) #16

Well, they will need to learn that once you have read a book to the end, that is how it works.

(Jeff Atwood) #17

That is an argument for “reset my read state in this topic” which strikes me as quite an advanced thing to need.


In some cases, yes. In other cases it’d be more like reading a technical book - sometimes you’ll need to go back to refresh your memory of something or another, and then that might require you to go look up something else, and then eventually you’ll want to return where you left off. Long bug topics might require this, for example. Or if you’re debating something with another user and you need to look up a few things earlier in the topic to put together an argument. This could also be helfpul for forum games such as Mafia.

From the abstract technical side this seems fairly simple, given one constraint on the requirements: you don’t need to remember the jump-list after you’ve left a topic. Given that condition, the jumps can be maintained in a user-side stack that’s reset to empty every time the user leaves the topic. When a user clicks a link to another post in the topic (possibly only the special ones within quotes and reply trackers), push their current location to the stack before jumping. If they hit the back button then pop the last location from the stack and jump to it. If the stack is empty, the back button is disabled.
In pseudocode:

// Defined somewhere the following functions can access.
var topicTracker = [];

// Navigation handler.
function onNavigationEvent(event)
    if (istopicInternalLink(event.targetUrl))
        if (!backButton.enabled)
            backButton.enabled = true;
    else if (isExternalLink(event.targetUrl) && !settings.openLinksInNewTab)
        // Do nothing.  Probably not the best way to arrange it,
        // but I wanted the condition to be explicit in this example.
        // Navigating out of topic.
        topicTracker = [];

    // Continue on as usual.

// Back button activation handler.
function onBackButtonActivated(event)
    if (topicTracker.length == 0)
        backButton.enabled = false;

More concretely, I don’t know enough about Discourse’s design, Ruby, Ember, etc. to help.

(Jeff Wong) #19

Unfortunately it’s not that simple since the constraint doesn’t apply – Discourse keeps your place even after you’ve exited the thread, so when next you visit the same thread: it navigates you to just after your latest read post. That’s also where the “go back” points to – your current “I have read up to here” position.


Sort of - from what I can tell it only keeps the last read post, not where you were when you exited the thread. I don’t think that should change, as they’re for two different purposes - one is long term memory (database backed) and the other is short term memory (browser based, and goes away after navigating away from or closing Discourse at the very latest).

Although it might make sense to make the short-term memory last longer than a single thread (so you can follow cross-thread links, for example). If you only care about cross-thread links, then just make sure the thread id is included as part of the location and change the conditions slightly so it doesn’t reset on cross-thread changes. If you want to remember as long as the window is open, then either never empty the stack (although you may want to truncate it after a while) or change the stack into a dictionary of stacks, one per thread (or if you’re feeling ambitious, a tree or other graph). In all cases, it’s functioning as a sort of working memory, not as long-term tracking of where you left off.

I think out of those possibilities that remembering across cross-thread links, maybe up to a size limit, is probably the best.

Edit: In terms of the book analogy, what’s being discussed isn’t like a bookmark showing where you are in reading a book, it’s like using your fingers* to hold your place(s) while you look up something(s) to refresh your memory.

*: Or post-it notes or scraps of paper, if you’re doing a lot.