K hotkey should select current post when none is selected

New request:

Original request

There is an E hotkey to edit a post. However, this only works if the post is “selected” by using the J or K hotkeys. I think it would be a huge improvement to have the E hotkey edit the current post (= the one in the URL / topic timeline) even if it hasn’t been selected using J or K.

2 Likes

This would be so bizarre and unexpected though. I’d consider it an anti-feature, personally.

4 Likes

Why though? Is scrolling through posts that different from using J to do the same?


Is there any way besides J and K to select a post so that post-specific keyboard shortcuts work?

If nothing is selected, then nothing is selected. Forcing a random selection feels very wrong to me.

I dunno, maybe someone from our team who uses keyboard shortcuts a lot could chime in.

People are used to having a selection target before object based actions become active.

Nobody wants a file manager which throws up a delete dialog if an object isn’t explicitly specified, why have an edit dialog before specifying what you want to edit?

1 Like

I was considering the post “selected” when it’s the number in the URL / post timeline, but I get your point. Doing what I requested would definitely go against expectations here.

I see now that I’m asking for the wrong thing. The case that prompted this request is when I’m looking through a long wiki post (generally first post), and therefore I’d have to scroll a bunch more to click the edit button. The problem is that both J and K select the second post, not the first, even when I’m barely scrolled into the first post. This kind of makes sense for J since it’s supposed to select the next post. But for K I think it would make more sense to select the current post (given that none has been selected yet). The current behavior means that I have to do J (or K) then K then E to edit the post I’m currently viewing. Ideally I’d like to be able to edit the post by just doing K then E. I know it’s only one key less, but the current behavior (for K in particular) is unintuitive.

Hopefully that makes sense. If not I can try to take a video since it’s hard to demonstrate with screenshots.

4 Likes

Yeah I think we should either re-title this topic or do a new one, I agree completely that K has surprising behavior. It should select the first visible post even if it is only partially visible.

Or in visual form if I hit K and the screen looks like this:

That :arrow_double_up: is what should remain on the screen and that post should be selected.

@dan I recall you worked on the selection logic, is this a simple change?

5 Likes

I edited the title and first post as best I can. Let me know if you want a new topic instead.

5 Likes

I changed the selection logic for K to select partially visible posts too. The logic for J remains unchanged.

https://github.com/discourse/discourse/commit/5715f0ad01b621cafe16785e71f2b93f2a48d669

7 Likes

This is working fantastically

:confetti_ball:

5 Likes