Keyboard shortcuts wish list

your alopogy has been accepted by the management :slight_smile:

2 Likes

Now I think you’re just messing with me. You didn’t think I could let that slip by, did you?

1 Like

Yes, for actual “select2” – think category drop downs, don’t think search, notifications, or menus :slight_smile:

I can definitely accept that up/down should work for places where a select html control would be used (or select2, or whatever Discourse is now using ;)). That I very much agree with.

Sorry, if our discussion got lost in translation, it didn’t occur to me that may have been the line of thought.

1 Like

Unless I’m confused, I don’t think there’s a keyboard shortcut to expand the new or updated topics. I can use G U to switch to the unread, but it would be nice to be able to just expand the latest.

I suggest . (period) as the shortcut.

3 Likes

That’s related to this:

https://meta.discourse.org/t/new-updated-bar-and-dismiss-new-button-unreachable-by-keyboard/18946

A shortcut to compose a new reply to the current topic.

I’ve seen the ` key used successfully for this purpose, (and it’s quite nice) but you have to check to make sure a textbox doesn’t currently have focus, etc,etc.

Shift + r replies to topic.

If you mean a shortcut for “Reply as New Topic”, I’d love that too. :slight_smile: Possibly t?

1 Like

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:

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