Keyboard shortcut Next/Previous continues key down reset to first item in list on load more


(lid) #1

In topic list view
//discourse-meta.s3-us-west-1.amazonaws.com/optimized/3X/b/f/bf8b05d2ada1db36268028b92cf832b8446c3d86_1_690x164.png

Using Next J shortcut. when reaching last item in the topic list. it will trigger a "load more"
then the selected item might jump to the first item in the list and starting the scroll all the way from the top.


(cpradio) #2

Is this from holding it down? Can you repro it by pressing it one by one quickly? (not holding down the key)

If not, then this is related to the key holding not being throttled/rate limited.


(lid) #3

Yes I can repo with quickly pressing J repeatedly as well.


(cpradio) #4

K, what browser are you using? (so I can attempt to repro this later on)


(lid) #5

chrome 37 / windows 8


(cpradio) #6

Question for you (since you seem to be active and very responsive – two things I like on bug reports), do you see any reason for j needing to loop back to the top after it reaches the end? Or k looping to the bottom when it reaches the top? As I believe that is what is happening here (since “Loading…” hasn’t finished).


(lid) #7

Personalty I think that the all thing is failing due to the implementation relying on css selectors.
I believe that at the moment load more triggered querying the selector “.selected” fails. could issue with synchronizations

Edit: I don’t think there is loop implemented , and that code comment is not accurately describing a simple boundaries check.


(cpradio) #8

Right, there is logic preventing it from looping when using k but not for j

Logic for not-looping using k

if (direction === -1 && index === 0) { return; }

(lid) #9

https://github.com/discourse/discourse/pull/2798

Can be tested by pasting this gist in console


(cpradio) #10

May have to “redo” that one or this one depending on which gets merged first :smile:

Mine or yours :smile: (but it looks to be an easy merge)
https://github.com/discourse/discourse/pull/2792


(Sam Saffron) #11