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

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

Merged
daviwil merged 3 commits into
masterfrom
dw-fix-shifted-keys
Feb 18, 2019
Merged

daviwil merged 3 commits into
masterfrom
dw-fix-shifted-keys

Conversation

@daviwil

@daviwil daviwil commented Feb 17, 2019

Copy link
Copy Markdown
Contributor

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 Compare February 17, 2019 21:12
@daviwil
daviwil merged commit 3e8105d into master Feb 18, 2019
@daviwil
daviwil deleted the dw-fix-shifted-keys branch February 18, 2019 01:52
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Multiple modifiers are not recognized correctly with non-latin characters due to uppercase checking

1 participant