Closed georgemandis closed 3 years ago
Belated update: If/when the major rewrite happens, Konami-JS should probably use key
if for no other reason than it will play nicely with physical keyboard plugged into iOS per #27. Using code
in iOS returns Unidentified
for arrow-key presses as of iOS 11.2.
Looks like IE11 and Edge doesn't have support for KeyboardEvent.key and KeyboardEvent.code yet https://caniuse.com/#feat=keyboardevent-key https://caniuse.com/#feat=keyboardevent-key But looks like there's a polyfill for that. If you plan on keeping supporting older browsers (Edge is not old, but microsoft isn't helping), warn about it in the docs or stay with legacy implementation https://stackoverflow.com/a/49903087
See this comment from pull request #20:
https://github.com/snaptortoise/konami-js/pull/20#issuecomment-141828647
Short summary: we shouldn't use these (theoretically)
https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/keyCode https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/charCode https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/which
We should be using these:
https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/code https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key
In reality there doesn't seem to be browser consensus with the new ones and the old ones work fine.
So... leaving this open for a future fix.