georgemandis / konami-js

Adding the Konami Code easter egg to your projects since 2009! Compatible with gestures on smartphones and tablets as well. Compatible with all front-end frameworks and vanilla JavaScript
http://konamijs.mand.is/
MIT License
961 stars 121 forks source link

iPad Pro keyboard compatability #27

Closed georgemandis closed 5 years ago

georgemandis commented 8 years ago

Right now Konami-JS works with gestures on an iPad Pro with the keyboard plugged in. It would be nice if the keyboard worked as well.

georgemandis commented 6 years ago

I'm not sure when this changed but as of at least iOS 11.2event.keywill return values on the keydown event. However the arrow keys will show up as UIKeyInputLeftArrow versus ArrowLeft.

It wouldn't be too hard to rewrite things to listen for arrow keys presses and account for these iOS-specific names, but I think it makes more sense to rewrite the whole thing in a more ES6-friendly way.

Just jotting this down in case anyone out there feels like picking this up :)

georgemandis commented 6 years ago

Thanks Patrick! That's helpful and promising. Maybe this is the year I get this implemented :)

On Mon, Apr 30, 2018 at 1:11 PM patrick kettner notifications@github.com wrote:

hey @georgemandis https://github.com/georgemandis!

The reason this is happening is because keydown events are (supposed to only be) triggered by keys that create something visual. you want to use the keypress event instead

georgemandis commented 5 years ago

This is now addressed in the 2.0 branch. It’s a little hacky, but I dont’ see a way around it without creating separate methods specifically for hardware keyboards on iOS, which I’d rather not do.