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

[key bindings] Can't trigger commands with a character that requires two presses #2200

Open
MarkZ3 opened this issue Jun 26, 2018 · 2 comments
Labels
keybindings issues related to keybindings

Comments

@MarkZ3
Copy link
Contributor

MarkZ3 commented Jun 26, 2018

Using Theia master as of today, Electron example.
If I try to open a terminal with the keybinding Ctrl+`
It doesn't work. I use the French (Canada) keyboard layout (Linux) which requires to press the ` key twice because the first time is used to write a character with that accent (è, ù, à). When using an english/US physical keyboard, this key is the quote/double-quote key, so it's possible to reproduce this issue with an English physical keyboard configured with the French (Canada) layout.

This works correctly in VS Code.

@paul-marechal paul-marechal added the keybindings issues related to keybindings label Jun 26, 2018
@paul-marechal
Copy link
Member

paul-marechal commented Jun 27, 2018

Part of the issue here: When we react to a keydown event, we check the following event properties, in that order:

- event.keyCode // locale-dependent
- event.keyIdentifier // locale-dependent and mostly deprecated
- event.which // locale-dependent and mostly deprecated
- event.code // locale-independent

Here is the result for a keydown event on the same physical key for two different keyboards:

(US International) code=Backquote, which=0, keyCode=0, key=Dead, locale=undefined, location=0
(French(Canadian)) code=Backquote, which=163, keyCode=163, key=#, locale=undefined, location=0

Note the common point: code=Backquote.

I think it shows which=0 keyCode=0 key=Dead when the key has to be pressed twice to get a result (in an input/textarea/etc).

In the case of the French(Canadian) keyboard, the keycode 163 seems to not even be mapped to anything back on a US keyboard.

How should we handle keybindings ? Should it be locale independent ? What would be the best conversion strategy ?

@svenefftinge
Copy link
Contributor

It is because of this microsoft/monaco-editor#1233

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
keybindings issues related to keybindings
Projects
None yet
Development

No branches or pull requests

3 participants