> 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…
Why keyboard shortcuts don't work on non-US layouts and how devs could fix it
41–50 of 212 posts
Re: Why keyboard shortcuts don't work on non-US layouts and how devs could fix it
#42The root of the problem is what this article correctly describes as the deprecated properties `keyCode` et al. These are essential raw Windows events that browsers in the '90s unwisely decided to expose. For any platform that is not Windows, these have to be emulated, which is not at all simple, since the details vary according to particular Windows keyboard layouts.
Re: Why keyboard shortcuts don't work on non-US layouts and how devs could fix it
#43It'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..
Windows, macOS and the various input libraries on Linux provide ways to query the key map - and a number of games do use this to provide localized bindings (Ubisoft and Blizzard are notorious for doing this right, something I appreciate as a dvorak user who hates dealing with rebinding or constantly having to toggle layouts). As far as the browser there is coming support for reading the keyboard layout as well: https://developer.mozilla.org/en-US/docs/Web/API/Keyboard/ge...
Re: Why keyboard shortcuts don't work on non-US layouts and how devs could fix it
#44It'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…
Re: Why keyboard shortcuts don't work on non-US layouts and how devs could fix it
#45Tilde ~ is similar: option-click and then space.
This makes the out-of-the-box keyboard shortcut for switching window on macOS unreachable on my macbook pro.
There are several default shortcuts on osx that are unreachable from international keyboards.
Re: Why keyboard shortcuts don't work on non-US layouts and how devs could fix it
#46I'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.
Re: Why keyboard shortcuts don't work on non-US layouts and how devs could fix it
#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…
Re: Why keyboard shortcuts don't work on non-US layouts and how devs could fix it
#48It'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…
The biggest annoyance for me is if you want to sometimes use hardware-level dvorak or another layout (which expects software-level qwerty) and sometimes use it in software. Like, if your keyboard runs QMK but you use it with a laptop and might want to use the laptop's built-in keyboard if you take it on the go.
GTK also has some weird issues if you have multiple layouts enabled where the shortcuts are in the wrong place and don't all work (happens in Dino and Gedit). So, I now have only qwerty enabled in Sway and I'll just edit the config if I ever need to change virtual layouts instead of doing it with a couple keypresses.
Re: Why keyboard shortcuts don't work on non-US layouts and how devs could fix it
#49On 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…
Re: Why keyboard shortcuts don't work on non-US layouts and how devs could fix it
#50It'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..
Other games like the Java version of minecraft didn't work with Dvorak when I tried them. Even with key remapping.