J/k navigation in lengthy topics

keyboard

(TechnoBear) #1

Using j/k to move up/down a topic now works well, and makes it possible to like, quote, reply to, etc. a given post by keyboard. However, if I’ve already read a thread, and return to it after new posts have been made, I enter the thread at the new post, but pressing j to move down starts somewhere near the top of the page. (In a short thread, it starts at the first post; in a longer thread it doesn’t, but I can’t work out what determines the starting position.) If there are only a couple of posts to move through, it’s not a problem, but in a lengthy thread it’s a bit irritating - and requires working out again where the new posts started to refind my place.

Any chance that j/k navigation could commence at the entry point of the thread, not at the top?


(cpradio) #2

I can’t recreate this anymore. Can you find me a lengthy topic so I can properly reproduce this?


(Dave McClure) #3

(cpradio) #4

Yeah, I still can’t recreate this. :frowning:

To repro, I tried the following:
Open the topic, start using j/k, it started at the top (as I’m not logged in and was viewing the top). – Good so far

I then exited and opened the topic using What happens when a topic has over 1000 replies? - Demo
I started to use j/k and it started on post 68. – Good.

I exited again, and opened the topic using What happens when a topic has over 1000 replies? - Demo, then scrolled 2 pages.
I then used j/k and it started with post 99 – Good.

I’m not seeing anything needing “fixed”.


(TechnoBear) #5

I followed a llink in my notifications menu to this thread: Reply as new topic - keyboard problem

It correctly took me in at the first unread post - #20. I pressed j and it started at HAWK’s post, #3.

I navigated to the last post using j, then used g, h to access the home page, and navigated back to the same thread from there. It took me in at the last post, but pressing j again started at post #3. I navigated back down to the bottom and on to the first “Suggested Topic”, which I visited. I then used g, l, navigated back to the same thread for the third time, arrived at the bottom post - and j still started at post #3.

Edit: I tested this with the try.discourse topic suggested above. I entered the topic at the first post, used j to navigate through the first 100 posts and left the thread. I navigated back to it via “Unread”, it opened at the correct spot, and j correctly commenced at post #100.

But my experience both here and on our own instance is that it consistently behaves as in my first example. So whether it needs a minimum number of posts, greater than the average thread, to trigger correct behaviour, or what, I’m not sure. I’ll try to test further and see if I can establish the facts more clearly.


(cpradio) #6

Okay, I think I’m missing something, can you define “navigated back to the same thread [from there]”? As I used g h and then pressed back to navigate back and it works as expected in both cases. I’m guessing you didn’t do that.

On a second thought, @codinghorror @sam should navigating to a topic (without a post id in the link) be taking me to the top or to the last post I read – like /last?


(TechnoBear) #7

No. I used g,l to get to the “Latest”, then used j to move down the topics until I reached that one, and Enter to open it. However, I’m pretty sure the behaviour is the same even on the odd occasion where I use the mouse to enter the topic.

I had a second thought about the try.discourse topic - that it might not be the number of posts in the topic which matters, but the number of posts read in one go. (One doesn’t often enter a topic and read 100 posts straight off.)

To test that, I set up a new account and visited the same topic, but only read 15 posts. Then I moved away using g,l, selected another topic using j and read that. Rinse and repeat, but this time returning to the first (1000 post) topic. I entered it at the correct place, and j resumed at post 15. After that, things went a bit hinky, and it behaved differently to my experience here or on our own instance. I used j to move through another 15 posts, then navigated away and back, as before. This time, I entered the thread several posts further on than I should have been, but j resumed from the correct place. I repeated this several times, each with the same result; I entered the thread about four posts further on, but j resumed at the correct spot.


(cpradio) #8

Okay, so I did these steps and it still starts at the last post (since I read the whole topic), may I need to choose a different topic…


(TechnoBear) #9

OK, that’s weird - I’ve read the whole of that (and other topics) multiple times and I still get the same behaviour. Are you using Firefox?

Edit As a further test, I moved away from this topic using the mouse, visited a coupke of “unread” posts with the mouse, returned here with the mouse (from the notification menu), arrived correctly at post #9 (this one) and j is resuming (as before) at post #2.

I’m about to go out, but I’ll test on other browsers when I get back.


(cpradio) #10

Ah ha! Now we are getting somewhere. This happens in Firefox, but not Chrome! :smile:

Edit: Recategorized the topic as a bug, as it really is. :smile:


(cpradio) #11

PR sent.
https://github.com/discourse/discourse/pull/2729

In short, $(‘body’).scrollTop() does not work in Firefox, you must use $(document).scrollTop(); as documented at


(Sam Saffron) #12

This topic is now closed. New replies are no longer allowed. Fix merged :slight_smile: