podio / jquery-mentions-input

MIT License
985 stars 333 forks source link

Bug Fixes for Usage with Android Soft Keyboard #195

Open HARVS1789UK opened 3 years ago

HARVS1789UK commented 3 years ago

As per this existing issue the jquery-mentions-input package does not work when trying to @mention things when using Chrome for Android (and probably any other browser on Android, though I haven't checked).

I have based my bug fix on some of the suggestions in that issue. On top of the existing issue raised regarding the keypress event on Android (which is now deprecated) no firing at all, I I also found that the soft keyboard on Android seems to return undefined 0 or 229 (which I think is 'keyboard buffer busy) for both e.keyCode and e.which meaning that much of the logic to update the inputBuffer and decide whether to undertake doSearch() was also failing and it was impossible to identify clicks of the del/backspace key

This fix is still a bit of a hack, which doesn't provide any support for text edits made anywhere but the end of the textarea input (e.g. adding/updating text in the middle of the textarea won't work as expected), but seems to at least provide some support for Android