braintree / restricted-input

Restrict <input>s to certain valid characters (e.g. formatting phone or card numbers)
https://braintree.github.io/restricted-input/
MIT License
68 stars 25 forks source link

Use different strategy for Android Chrome #22

Closed intelliot closed 7 years ago

intelliot commented 7 years ago

With third party keyboards on Android (such as the Samsung keyboard), the keypress event never occurs, which breaks everything.

I noticed that the IosStrategy doesn't use this event. Using this strategy appears to work on Android.

We'll want to do more testing and rename the strategy, but this PR shows the minimal change that seems to work.

Keyboards:

Other actions:

crookedneighbor commented 7 years ago

I remember trying this, and there was a reason I didn't do it, but I don't remember what the reason was now.

crookedneighbor commented 7 years ago

Does the iOS strategy have the same paste workarounds that the Android Chrome strategy had?

EvanHahn commented 7 years ago

I'd make sure to check this with several different keyboards on iOS. I'd also make sure to test autofill (if you can) and pastes.

If that all works, I'd rename the strategy to something like MobileStrategy or something.

intelliot commented 7 years ago

@EvanHahn I'm guessing that where you wrote iOS, you mean Android

EvanHahn commented 7 years ago

@intelliot Yes, good catch.

intelliot commented 7 years ago

Added a couple checklists to the original PR description

intelliot commented 7 years ago

This doesn't always work with paste on Android. Going to try something different.