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

Ignore AltGr option or filter #158

Open
MadLittleMods opened this issue May 12, 2016 · 0 comments
Open

Ignore AltGr option or filter #158

MadLittleMods opened this issue May 12, 2016 · 0 comments

Comments

@MadLittleMods
Copy link

MadLittleMods commented May 12, 2016

I am not a native user of a keyboard layout that has AltGr so forgive my ignorance. AltGr is a special key in the browser that registers two key events for CtrlLeft and AltRight. It is used to get to the symbols under the numbers that English users would normally use Shift for. !@#$%^&*()

This is especially painful if you want to bind Ctrl + Alt + [0-9] which works great work on English layouts but completely clobbers users with AltGr.

Many ways to implement in keymaster: A new mode like key.noAltgr() wouldn't fire events if we suspected the AltGr key to be pushed. Could be an extra string bit to add onto the hooks ctrl+alt+1-altgr, note the -altgr. Or could be a new option to key.filter(e, isAltgr)

This wouldn't be bullet proof as the only way I know how to detect AltGr is looking at the location property on the KeyboardEvent for the Ctrl and Alt keys; which doesn't account for someone actually pressing the left control and right alt (seems like a odd use case vs obliterating the whole userbase with AltGr though)

AltGr fires the following events:

  • Ctrl: { code: 'ControlLeft', location: 1, ... }
  • Alt: { code: 'AltRight', location: 2, ... }

As a note, we saw this mainly with AZERTY and Swedish layouts which have the AltGr key.

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

No branches or pull requests

1 participant