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

Report shifted writing system keys correctly in Chromium 62+ #238

Merged
merged 3 commits into from Feb 18, 2019

Conversation

Projects
None yet
1 participant
@daviwil
Copy link
Contributor

commented Feb 17, 2019

Description of the Change

This change fixes an issue introduced somewhere around Chromium 62 (I looked for a while and couldn't find an explicit record of this) which causes "shifted" writing system keys to be reported in their non-shifted form in the KeyboardEvent.key property (e.g [ instead of { when shift is held). I believe the former behavior was considered a bug in Chromium so we're now adjusting to the new behavior since it's considered correct.

The fix is to use KeyboardEvent.code to look up the shifted version of any writing system key despite what KeyboardEvent.key is reporting. I've had to be pretty surgical with where I introduced this change so that I don't negatively affect other key handling workarounds, specifically those related to the use of the Alt modifier.

This PR also updates the way we run tests for this repo since devtool is no longer maintained and well behind the latest Chromium version.

Alternate Designs

There might be a better logic flow that could be used here but it would take a much longer period of refactoring. This solution was the simplest that fixed the issue without negatively impacting other cases.

Benefits

Key combinations like cmd+{ are now correctly reported in Atom built on Electron 3.0.

Possible Drawbacks

None that I'm aware of.

Applicable Issues

Fixes #237

@daviwil daviwil force-pushed the dw-fix-shifted-keys branch from ac9393e to 4206457 Feb 17, 2019

@daviwil daviwil merged commit 3e8105d into master Feb 18, 2019

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@daviwil daviwil deleted the dw-fix-shifted-keys branch Feb 18, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.