Live data from Hacker News

Why keyboard shortcuts don't work on non-US layouts and how devs could fix it

tkainrad.dev

31–40 of 212 posts

Re: Why keyboard shortcuts don't work on non-US layouts and how devs could fix it

#31

There is also a whole slew of issues with Polish characters. Polish keyboard setup relies on "right-alt" and a letter to get it's diacritics variation. Ie: 'ą' is 'right-alt'+a Windows for backwards compatibility reports 'right-alt' as 'alt+control'. Many applications developers assign key combos with no negative checks. So 'ctrl-s', typically used for save gets triggered when user wants to type 'ś'. To repeat, "righ…

ah, the Polish Alt-Right is a problem?

Re: Why keyboard shortcuts don't work on non-US layouts and how devs could fix it

#32
post #15

On a tangent, why are non-qwerty keyboards so poorly designed for programming? And specifically, why is apple’s azerty layout so terrible? Just look at this image: https://i.stack.imgur.com/3LL8a.png Can you find the [ and ] keys? If you’re having trouble, it’s because you have to use 2 (two!) modifier keys and activate the ( or ) keys, which themselves are clumsily placed. This cannot be typed one-handed in a comfor…

It's the other way around. The keyboard was the foundation for the programming languages and shortcuts, like moving with hjkl in vim. No German keyboard user would have created a language like C with curly braces, when you would break your fingers typing this (alt 8 is {, alt 9 is }, and alt+5 is [, alt+6 is ] ).

I use a US keyboard for that exact reason

Re: Why keyboard shortcuts don't work on non-US layouts and how devs could fix it

#33
I’ve gotten so used to switching between keyboard layouts when moving from e-mail to coding that I don’t think about this much, but it can be tremendously irritating when I’m on a new machine or just forget to switch.

(pt-PT keyboard, parenthesis and brackets are either an off-by-one or require Alt-Gr+Shift to type.)

Using a US keyboard layout for a while really drives home how much it influenced popular CLI character choices (like path separators, pipe characters, etc.), too.

Re: Why keyboard shortcuts don't work on non-US layouts and how devs could fix it

#35
post #28

As a kid, I remember being utterly confused, when most games with a console would have the key ` to open it. WTF is the key ` and where is it? For a kid it wasn't that easy to understand that there are such things as different keyboard layouts. Turns out that ` is a single key press to the left of the '1', in English, while it is a bit obscure character to write in other languages. In mine, you have º and ª in that p…

Also programming languages used it as an alias for exec. Even if you have a ` key, on some layouts (such as the Irish keyboard layout) it can be a weird key to type due to dead key behaviour, often requiring multiple presses to respond and eating the next keypress.

Re: Why keyboard shortcuts don't work on non-US layouts and how devs could fix it

#36

It's not just international keyboards that are affected by this. I'm a Dvorak user so I run into these issues from time to time. As the article explains, there is a difference between the physical keyCode and character it corresponds to. Which to use really depends on what it is being used for, and there are situations for both. The article suggests checking the character typed, but this is not always the correct way…

> For instance, the most annoying are games which default to WASD based on the letter typed and not the physical keys

Is it even possible to do anything else? I can’t imagine keyboards report their physical layout..

Re: Why keyboard shortcuts don't work on non-US layouts and how devs could fix it

#37

It's not just international keyboards that are affected by this. I'm a Dvorak user so I run into these issues from time to time. As the article explains, there is a difference between the physical keyCode and character it corresponds to. Which to use really depends on what it is being used for, and there are situations for both. The article suggests checking the character typed, but this is not always the correct way…

Is there a programmatic way to figure out what letter corresponds to a given keycode without that key being pressed? Because you may have to display that info somewhere to give an indication what the user has to press.

Re: Why keyboard shortcuts don't work on non-US layouts and how devs could fix it

#38
post #36

It's not just international keyboards that are affected by this. I'm a Dvorak user so I run into these issues from time to time. As the article explains, there is a difference between the physical keyCode and character it corresponds to. Which to use really depends on what it is being used for, and there are situations for both. The article suggests checking the character typed, but this is not always the correct way…

> For instance, the most annoying are games which default to WASD based on the letter typed and not the physical keys Is it even possible to do anything else? I can’t imagine keyboards report their physical layout..

The only possibility is to allow the user to assign custom keys, which is pretty common.

It’s impossible to know the physical layout for absolute certainty. For all you know, my “Enter” could be a pedal under the desk.

Re: Why keyboard shortcuts don't work on non-US layouts and how devs could fix it

#39
post #36

It's not just international keyboards that are affected by this. I'm a Dvorak user so I run into these issues from time to time. As the article explains, there is a difference between the physical keyCode and character it corresponds to. Which to use really depends on what it is being used for, and there are situations for both. The article suggests checking the character typed, but this is not always the correct way…

> For instance, the most annoying are games which default to WASD based on the letter typed and not the physical keys Is it even possible to do anything else? I can’t imagine keyboards report their physical layout..

Scancodes from PS/2 keyboards are layout-based.

Re: Why keyboard shortcuts don't work on non-US layouts and how devs could fix it

#40

I'm french canadian and the most satisfying solution I've found is to keep switching from one keyboard layout to another. I mostly use the american layout when I code, and the french canadian one to communicate. I got used to it in about a week.

I now exclusively use US-International No Dead Keys. I just use the right alt key + qpys to get äöüß. I hate having to switch layouts and switching layouts accidentally while typing. Those key combinations are not worse than []{}\ on the german layout.
Post reply on HN