Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Spanish Keyboard: BracketLeft is not populated in keymap #36

Open
bryphe opened this issue Oct 6, 2017 · 2 comments
Open

Spanish Keyboard: BracketLeft is not populated in keymap #36

bryphe opened this issue Oct 6, 2017 · 2 comments

Comments

@bryphe
Copy link

bryphe commented Oct 6, 2017

Hi there,

First off, thank you for this library! It was tremendously helpful in adding intl keyboard support for my project.

It's worked great in general, but I'm seeing a strange issue on Windows 10 with the Spanish keyboard (es-ES).

When I call getCurrentKeymap, it seems to be missing the BracketLeft key in this case:
image

This reproduces in both Electron (v1.7.7) and Node (v.7.2.1).

A minimal repro is as follows:

  • Create a new folder
  • Run npm install keyboard-layout
  • Run node for the node CLI
  • Run require("keyboard-layout").getCurrentKeymap()["BracketLeft"]

Expected: Should see an entry for this key binding.
Actual: No entry is shown, but BracketRight has a key map entry:

image

Thanks for your help.

@Ben3eeE
Copy link
Contributor

Ben3eeE commented Oct 7, 2017

Hey,

Thank you for the report! This is happening because BracketLeft is on a dead key. We had to stop translating dead keys on Windows because translating them to the keymap changed the in-progress dead key state in the kernel-mode keyboard buffer. This caused problems in Atom with being able to type dead keys in certain circumstances. Relevant PR here: #19 and #29.

Resolving [ on a Spanish layout still works in Atom because we are resolving keystrokes using KeyboardEvent.key from chromium and only fallback to the keymap from keyboard-layout in special cases. This translation is done in atom-keymap https://github.com/atom/atom-keymap/blob/fe3438a8ae4034ee56e30c3ea07920e75b4211cc/src/helpers.coffee#L137

We do want to support dead keys in keyboard-layout some day because having them in the keymap would enable us to bind commands to dead keys on Windows in the same way as we do on macOS. Currently it is not possible at all to bind commands to dead keys on Windows in Atom.

@bryphe
Copy link
Author

bryphe commented Oct 10, 2017

Thanks @Ben3eeE for the detailed response! Very helpful and it makes sense - having the dead key state change underneath you would be a deal breaker...

We do want to support dead keys in keyboard-layout some day because having them in the keymap would enable us to bind commands to dead keys on Windows in the same way as we do on macOS. Currently it is not possible at all to bind commands to dead keys on Windows in Atom.

Excellent! It's great to know you plan on supporting this eventually. In the meantime, I'll have a similar restriction in my project.

@Ben3eeE Ben3eeE changed the title Windows - Spanish Keyboard: BracketLeft is not populated in keymap Spanish Keyboard: BracketLeft is not populated in keymap Jan 3, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants