Live data from Hacker News

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

tkainrad.dev

51–60 of 212 posts

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

#51
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..

A few games map based on the key codes. For example, SC2 will get grid layout right on Dvorak or Colemak without any remapping. It did take me directly emailing a designer, who passed it on to the developers, though. ;)

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

#52
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…

QWERTY is awful for programming. I use https://www.kaufmann.no/roland/dvorak/. which puts control characters on the number row. `&[{}(=*)+]` is 1 to 0.

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

#53
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…

Most keyboard-layouts predate programming-languages, because they were designed for typewrites decades before the first modern computers even existed. So there did gave much to usage of special chara back then. Additionally most languages were designed by americans, on US-layout, which had a great impact on usages of different char in our digital world. Like for example the usage of @, which AFAIK was only used for e-mail because there was no other free char on the developers keyboard available.

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

#55

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…

This is actually fascinating to me. I’ve dealt with keyboard input numerous times (not WinForms or browser either) and I always devised a way where control characters were a bitwise with the keycode. You would have to include this in any input mapping. I can totally see where this key combo issue would be a problem in a UI scenario in the browser or other shortcut-laden desktop app.

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

#56
post #47

> What baffles me is that the problem exists in apps used by millions of people every day, developed by gigantic corporations who pride themselves with having the best engineers in the world. Why is this baffling? Because the underlying technical issues are rather trivial! > Hint for developers: Switch your computer’s keyboard layout to something other than US to debug your application’s shortcut handling on differen…

If there was a standard way to define hotkey bindings, a simple linter could take care of that. It just shows how far we still have to go in terms of good UI creation tooling.

This is part of why I’d like to see more VSCode-as-an-OS (disclaimer work on VSCode)... imagine writing only the code to go from bytes on disk => view and back, and getting for free: version control, command palette, keybindings, Windows/Mac/Linux/Web support, file explorer, tabs, split views, hot exit, etc etc etc.

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

#57
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…

I think the answer is that their engineers overwhelmingly use the English layout keyboards and work in Cupertino. Most improvements to coding on a Mac I have seen have a design-for-self element where apple employees are eating their own dog food and want to improve the taste.

C was famously designed in Murray Hill on a system with Teletype 37s, which featured then-fairly-novel { and } keys (as it so happens, the shifted versions of [ and ]).

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

#58
I am using a French azerty keyboard, but since '[]' and '{}' are in wierd locations,i always remap them to US-alike. This breaks the diacritics, but oh well

I also like my ';' and '.' swapped, because dot is clearly more useful when typing in terminal

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

#60

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…

Another Dvorak typist here! Personal funny anecdote: I learned vim modal navigation after I learned Dvorak, and never bothered to remap the keys. Totally debilitating if I'm using a coworkers QWERTY keyboard for vim navigation, but at least I can still navigate on remote servers without reconfiguring anything!
Post reply on HN