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

'KeyboardEvent.keyIdentifier' is deprecated warning in Chrome #53

Closed
web-padawan opened this issue Jul 28, 2016 · 6 comments
Closed

'KeyboardEvent.keyIdentifier' is deprecated warning in Chrome #53

web-padawan opened this issue Jul 28, 2016 · 6 comments
Assignees

Comments

@web-padawan
Copy link

@web-padawan web-padawan commented Jul 28, 2016

Description

'KeyboardEvent.keyIdentifier' is deprecated and will be removed in M53, around September 2016. See https://www.chromestatus.com/features/5316065118650368 for more details.

This warning is caused by line 182:

transformKeyIdentifier(keyEvent.keyIdentifier) ||

Seems that this should be removed.

@web-padawan
Copy link
Author

@web-padawan web-padawan commented Aug 25, 2016

I'm going to send a PR to fix that warning.
Shouldn't we get rid of the keyIdentifier at all?
/cc @valdrinkoshi

@valdrinkoshi
Copy link
Member

@valdrinkoshi valdrinkoshi commented Aug 25, 2016

I'm afraid it would be a breaking change as other browsers don't support key yet, and the other options (keyCode, charCode) are no better than keyIdentifier...

@samccone
Copy link

@samccone samccone commented Sep 2, 2016

@valdrinkoshi thoughts on falling back to key Identifier if key is not supported?

@valdrinkoshi
Copy link
Member

@valdrinkoshi valdrinkoshi commented Sep 2, 2016

@samccone that's already happening, see https://github.com/PolymerElements/iron-a11y-keys-behavior/blob/master/iron-a11y-keys-behavior.html#L178

Fall back from .key, to .keyIdentifier, to .keyCode, and then to .detail.key to support artificial keyboard events

@samccone
Copy link

@samccone samccone commented Sep 2, 2016

correct, but switching the order of the fallback so that .keyIdentifier is lower on the || fall through.
Testing a patch locally now.

samccone added a commit to samccone/iron-a11y-keys-behavior that referenced this issue Sep 2, 2016
@valdrinkoshi
Copy link
Member

@valdrinkoshi valdrinkoshi commented Sep 2, 2016

Unfortunately the warning gets displayed anyways if for example you hit "?" (shift + / key in US keyboard). I think that normalizedKeyForEvent should be converted to something like:

if (keyEvent.key) {
  return transformKey(keyEvent.key, noSpecialChars);
}
if (keyEvent.detail && keyEvent.detail.key) {
  return transformKey(keyEvent.detail.key, noSpecialChars);
}
return transformKeyIdentifier(keyEvent.keyIdentifier) ||
  transformKeyCode(keyEvent.keyCode) || '';

I'll take care of that (there are some tests to be fixed)

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

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.