Live data from Hacker News

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

tkainrad.dev

71–80 of 212 posts

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

#71
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 the real solution. Providing a native API with i18n built in would quickly start resolving this issue.

It reminds me of developers who want to capture link clicks for internal navigation but acccidently block right or middle click as well because it is the easy thing to do.

If we provide APIs that make the right thing the easiest we will have more websites that do the right thing.

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

#72
post #63
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…

We all suffer from character blindness of some sort. For you: ` - that thing isn't formally defined in English either as far as I know. In English we don't have any diacritics. We do have a few extra symbols, beyond the alphabet for certain situations. Quotations ... " ... meh should be 66 99 and that will be fixed up by DTP software. We use ' to denote a dropped letter - abbreviation. There are a few others. I won't…

> What is it?

Not sure if you meant this literally, but I've seen it refered to as a back tick. As to what it's for, I have no idea either. I can't recall ever seeing it outside of programming.

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

#73
post #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.

Not that I know of.

Also, not that “alt-s” will produce an s character on a US keyboard on windows, but will not produce an s on MacOS with a US layout - alt-anything will produce all sorts of interesting characters on MacOS.

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

#74
post #67
post #63

Earlier quoted context omitted.

We all suffer from character blindness of some sort. For you: ` - that thing isn't formally defined in English either as far as I know. In English we don't have any diacritics. We do have a few extra symbols, beyond the alphabet for certain situations. Quotations ... " ... meh should be 66 99 and that will be fixed up by DTP software. We use ' to denote a dropped letter - abbreviation. There are a few others. I won't…

I think back in the day (typewriters thru... 90s?) you wrote quoted text `like this.'

This still seems to be "house style" for a certain brand of "old school" open source mailing list.

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

#75
post #34

The author spends a lot of time explaining the APIs that have been deprecated but doesn’t say which one is the correct one to use now...

They do briefly mention it, `key`

https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEve...

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

#76
For Western European devs: do try the "USA International (AltGr dead keys)" layout.

It's great for programming and quite good for all the Western European languages (maybe not so much for Eastern European languages that are more creative with diacritics).

I wish I'd known about it before spending a lot of time creating my own custom layout for Linux and Windows, although since I went through the trouble that's what I still use.

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

#77
post #63

Earlier quoted context omitted.

We all suffer from character blindness of some sort. For you: ` - that thing isn't formally defined in English either as far as I know. In English we don't have any diacritics. We do have a few extra symbols, beyond the alphabet for certain situations. Quotations ... " ... meh should be 66 99 and that will be fixed up by DTP software. We use ' to denote a dropped letter - abbreviation. There are a few others. I won't…

> What is it? Not sure if you meant this literally, but I've seen it refered to as a back tick. As to what it's for, I have no idea either. I can't recall ever seeing it outside of programming.

On a mechanical typewriter you'd have a button that would "revert" the position you'll write to by one character - also known as backspace.

So if you pressed backspace followed by "`", you'd give the last character a grave accent.

That's my theory for it being called backtick anyways.

Nowadays you could configure your input method to make that key give the next character a grave accent

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

#78
post #70

Earlier quoted context omitted.

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…

> 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. '@' meant 'at' looong before e-mail was invented.

But traditionally mainly (only?) in the context of "at [price per unit]", not "at [location]".

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

#79
post #65
post #20

Also while we're at it...fix this for bitlocker. Makes special characters in passwords a nightmare and you need to memorize where that stupid character is...

It’s unwise anyway to use letters outside of a-Z0-9 in a password unless absolutely necessary

It's also unwise to use a password, when you should be using a passphrase[0]. See eg https://www.explainxkcd.com/wiki/index.php/936.

Edit: 0: or at least a pass-multiple-words, depending on how picky your definition of "phrase" is about grammer. It shouldn't be "word", singular, is the point.

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

#80

Dead keys are particularly fun, as it takes two key presses to produce a result. Accessibility of keyboards/layout could indeed be improved. I switched to custom US layout, because of too many issues with a non-US layout. My custom layout uses AltGr combinations to add a few local characters. It is a bit clumsy, but at least keyboard shortcuts work most of the time.

I have done the same, on my work laptop I specifically asked for it to come with US layout.
Post reply on HN