Keyboard shortcuts for "Next/previous section" do not work with German keyboard layout

keyboard

(Gerhard Schlager) #1

The keyboard shortcuts for “Next/previous section” do not work as expected with German keyboard layout.

I’ve tested it on Windows 8 with latest Chrome and German keyboard:

  • ` is a Dead Key on the German keyboard. So I have to press it twice or another key like Space before it works.
  • In order to produce the ~ I actually have to press AltGr and +.
    I guess the AltGr modifier stops this from working in Chrome.
    It doesn’t work in Internet Explorer either. However, it works in latest Firefox.

Could we use some other keys that are available on all keyboards (simple characters or the same one with Shift modifier)?

BTW: I had to search this forum in order to know what was meant with “section” in the keyboard shortcut help. Maybe adding a hint that Latest, New etc. are sections would help.


Keyboard shortcuts wish list
(Jens Maier) #2

Good point. To take it a step further, all these keys should probably be localizable.


(Gerhard Schlager) #3

I have to disagree. Keyboard shortcuts shouldn’t be localized. As a user I’d expect them to always be the same, regardless of the locale used by Discourse.

For example here in this forum English is the default and changing it in my profile is not allowed. When I visit a German forum I’d like to use the same shortcuts.

So, choosing shortcut keys with letters and, if you have to, some often used symbols, should suffice.


(Jens Maier) #4

I haven’t been clear enough.

Yes, keyboard shortcuts should always use the same keys, but by that I mean they should always map to the same scan codes, i.e. physical buttons. Localization was the wrong term to express this, I think.

For example, telnet in a PuTTY terminal does this. It announces that the Escape character is '^]', but to produce this character code, I type Ctrl++.


(cpradio) #5

I’ll take a look at this next, can someone clue me in on what the appropriate fix should be?

@gerhard believes adding “SHIFT” to the keys would solve it, if that’s the case, I’m cool with it, although it would “break” for existing keyboard users until they realize they need the shift key.

Thoughts?


(cpradio) #6

Second thought, I’m adding shift+j and shift+k on top of j and k support, so it should work for German layouts and other keyboard layouts. :smile:

I should have a PR for this soon.


(cpradio) #7

PR submitted
https://github.com/discourse/discourse/pull/2725


(Gerhard Schlager) #8

@cpradio Thanks for doing this, but you added it for the wrong shortcut. :wink:
k and j work fine.
`/~ (Next/previous section) are the ones that do not work.


(cpradio) #9

Oh, I see. I saw shift k and shift j and my brain forgot what it read before! :laughing:

Okay, the build broke anyway (due to an unrelated issue), so they haven’t merged it. I can still correct this! I don’t plan to update the shortcut text, but you can alter than in your own locale file. :smile:

As an aside, if you can tell me what modifiers to use (for the typical shortcut to work), Discourse is using Mousetrap - Keyboard shortcuts in Javascript

It supports all of the keys (that I can tell, but I don’t know which one is for AltGr, alt, option, command or meta)

I’ll just use the SHIFT+keys you recommended, versus mucking with a dead key (although the alt key would likely work for the latter one).

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


(Gerhard Schlager) #10

Yeah, that’s fine with me.


(Régis Hanol) #11