Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

<, >, and | are mapped incorrectly on Chrome and Safari (German keyboard layout) #1724

Open
db39 opened this issue Jan 22, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@db39
Copy link
Contributor

db39 commented Jan 22, 2024

Description

Typing <, >, and | doesn't input the correct characters to a target machine with a German keyboard layout. This has been tested using a Mac as a client machine, with the German - Standard keyboard layout, on Chrome and Safari. Firefox does not have this issue.

What's the behavior that you expect?

We expect that hitting the < key (directly to the right of left-shift) produces a < on the target machine. Additionally, we expect < and shift to produce a >, and we expect < and right-hand Option (on Mac) to produce |.

What's happening instead?

On Chrome and Safari, typing < instead produces ^ , < and shift produces °, and < and right-hand Option produces .

The underlying issue seems to be the way each browser interprets the keycode for the < key.

Firefox correctly identifies the keycode as 60:

{
  "key": "<",
  "keyCode": 60,
  "which": 60,
  "code": "IntlBackslash",
  "location": 0,
  "altKey": false,
  "ctrlKey": false,
  "metaKey": false,
  "shiftKey": false,
  "repeat": false
}

On Chrome and Safari, < is interpreted as keycode 188, > as keycode 190, and | as keycode 220. These appear to be the keycodes used for an English layout, but they're incorrect for the German layout.

What are the steps to reproduce this behavior?

  1. Set your Mac's keyboard layout to "German - Standard"
  2. Open TinyPilot in Chrome or Safari
  3. Open a text editor on the target machine (with a German keyboard layout)
  4. Hit the < key
  5. See ^

Screenshots

@db39 db39 added the bug Something isn't working label Jan 22, 2024
@mtlynch
Copy link
Contributor

mtlynch commented Jan 22, 2024

We should be able to work around this on the server. We should be able to detect the browser and client language from the HTTP request, and then the TinyPilot server can remap the keys when we recognize that it's German keyboard layout + buggy browser.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants