Keyboard shortcuts wish list

Aha neat.

Shift+t would make more sense, but otherwise I agree.

I swithered over that, but left off the Shift because it’s replying to a post (as new topic), not to the topic. But either way, I’d be delighted to hacve it.

It would just be difficult to target the correct post from a keyboard shortcut if you’re opening it as a reply.

I figured the Shift+T would just target the first post in the topic as its source.

Shift+T from the topic list would open a topic in whatever category you’re browsing.

[quote=“fysics, post:23, topic:15952”]
It would just be difficult to target the correct post from a keyboard shortcut if you’re opening it as a reply.
[/quote]Actually, it’s a doddle. :smile:
Use j/k to move through the thread to the relevant post, which brings it into focus to use the appropriate keyboard shortcut for the post action.

2 Likes

I have this programmed. Once my other PRs are accepted, I’ll push this one through too.

1 Like

There is a lot of info in this thread, can everyone take a quick read again and verify the only missing item left is Reply to Topic.

Thanks!

PR for Reply as New Topic:
https://github.com/discourse/discourse/pull/2724

3 Likes

Is it possible to set custom keyboard shortcuts or alter them without editing app/assets/javascripts/discourse/lib/keyboard_shortcuts.js?

I should rephrase. It’s definitely possible. What’s the easiest way to do that?


EDIT: Here’s what I did, roughly. I’m on a docker install.

  1. Download https://raw.githubusercontent.com/discourse/discourse/master/app/assets/javascripts/discourse/lib/keyboard_shortcuts.js

  2. Make adjustments.

  3. Create a diff file and move into the docker shared folder.

  4. Add a line to app.yml to patch keyboard_shortcuts.js:

     - exec:
         cd: $home/plugins
         cmd:
           - mkdir -p plugins
           - git clone https://github.com/discourse/docker_manager.git
           - patch ../app/assets/javascripts/discourse/lib/keyboard_shortcuts.js < /shared/keys.diff
    
  5. Rebuild Discourse: ./launcher rebuild app

What changes did you make? Would it make more sense to have them in core?

1 Like

I added a shortcut for ` to reply to the current topic by duplicating the shortcut for Shift+R.

I then removed the existing shortcuts for ` and ~. I wasn’t sure if it would interfere, but I wanted to play it safe.

I mainly did this because my userbase is used to that shortcut from another board and they appreciate the consistency.

The only useful request that I can make of this is that admin or possibly even per-user customization of default keyboard shortcuts would be great.

(fyi, my patch file broke after about 2 commits. So much for that quick fix :stuck_out_tongue_closed_eyes:)

Yeah, I know one of my commits lately completely removes ` and ~ so that part is now done (because they weren’t good for German keyboard layouts, so they were replaced with shift k and shift j). The shift+R to ` would still need to exist.

1 Like

Maybe I’m misunderstanding what you’ve said here, but my experience is that focus is not set on either the profile or the hamburger menus when first opened; they need to be closed then opened again and all is well. Nothing will set focus on the notification menu.

Is that what you meant, and I’m just misreading it, or…?

(Tested on Firefox and Chromium.)

Yeah, it is because the content is loaded after the menu is called, it is dynamically placed into the menu. But if you press it twice, it works the second time around. So definitely has room for improvement, low on the list though.

1 Like

Thanks - it’s not a problem. I just wanted to clarify that this is the expected behaviour.

For now. I’d like to see that opened as a Bug though, as it really shouldn’t happen that way, and I’ll lose it in this thread :frowning:

I keep coming here and removing the Star because I think I’ve completed it.

Done.

My “wishlist” for a couple keyboard shortcuts:

  • H move selection to top (similar to current # + 1 + enter
  • L move selection to bottom (similar to current # + 999 + enter

You mean the Home and End keys? Or am I missing something that yours does, mine doesn’t?

1 Like

Aha! On my mac there are no such keys, unless I use Fn + Left arrow for Home. We hardly do that on macs, so much I’ve wrongly tried it with Up arrow, it didn’t work, and I gave up! :stuck_out_tongue:

Also that’s not on the ? Help! :frowning:

Thanks! :slight_smile:

You are correct, that they aren’t listed. @codinghorror, I’m torn to add it because 1) there is code behind those buttons (since Discourse uses infinite scrolling), but 2) it is mimicking existing browser functionality, so it does what a browser would do if ALL the data already existed on the page.

Your thoughts?