viresh-ratnakar / exolve

Online interactive crossword software in JavaScript
MIT License
71 stars 15 forks source link

In Firefox for Android the cursor jumps two steps after each keypress with most keyboards #8

Closed Antagony1060 closed 4 years ago

Antagony1060 commented 4 years ago

Firefox version: 68.1.1 – I've also tested it in Firefox Focus and it's the same in that.

It also repeats the first letter typed, instead of entering the new one. I've tested it with several keyboards – including Gboard, Swiftkey, Swype, and Simple Keyboard – and all but the last one suffered the same problem, but the backspace key doesn't work in that one for some reason.

Terrific work on this, by the way! So simple to use and adding bars and hyphens based on the enumeration works a treat.

viresh-ratnakar commented 4 years ago

Thanks for the kind words!

Yes, I've noticed this bug for Firefox for Android.

I looked into it a bit, and found a couple of causes: (a) event-processing seems weird in Firefox for Android: while in the middle of handling the input event upon entering a letter, the code jumps into the handler again (b) setting the value of the input element through javascript seems to be triggering the event too, which seems to be a bug in FF for Android.

I can code workarounds for these. That will add a bit of complexity. I'm trying to first research a bit to see if these are known issues/bugs in FF for Android and if there are plans to fix or known workarounds. I'll follow up.

Antagony1060 commented 4 years ago

If it helps the Guardian crossword used to suffer the exact same problem, but it's been fixed for a while now. I don't know how accessible, or not, their underlying scripts are, but perhaps you can glean something from them?

viresh-ratnakar commented 4 years ago

Thanks, I looked at the Guardian scripts, but they seem inscrutable.

I am leaning towards not fixing this, at this time -- fixing this would require some ugly special-case code. I'm hoping that a future Firefox for Android release will fix this. I'll try to reproduce in a small test case and file a bug with them.

Meanwhile, here are a couple of workarounds:

  1. Typing in uppercase avoids the double jump (the double jump happens when my code changes the letter from lowercase to uppercase, generating a buggy extra input event).

  2. To change an existing entry, first delete it using delete/backspace, and then enter the new letter.

Antagony1060 commented 4 years ago

Ok, well thanks for taking the time to look into it.

Testing again, it seems that every keyboard behaves differently, with Gboard being the most problematic – it won't even stay in caps-lock, so your first workaround doesn't work with it.

Curiously, however, SwiftKey seems to be working just fine now! I swear it was doing the same as Gboard when I first tested it. And better still, it also has an option to show arrow keys, which makes navigating around the grid easier. So I would recommend using that to anyone else looking for a solution to the two-step issue.

Antagony1060 commented 4 years ago

I figured out why SwiftKey wasn't working before: I tested it in Firefox Focus rather than normal Firefox. As Gboard had behaved the same in both browsers I figured – incorrectly as it turns out – that they must be using the same event handling code base.

viresh-ratnakar commented 4 years ago

Closing this, as it's unlikely that I can address the issue comprehensively. Hopefully a Firefox for Android update will fix the bug at some point.

Antagony1060 commented 1 year ago

I don't know whether it's an update from gboard or Firefox, but I'm pleased to say it has suddenly started behaving correctly! Thought you might like to know…

viresh-ratnakar commented 1 year ago

Nice!

I just tried it on my phone and it isn't fixed for me yet though. Firefox version: 108.1.0, gboard: Android version 13 (could not find a separate version for gboard).

Antagony1060 commented 1 year ago

Interesting. I've got Firefox 108.0.8 so I guess it's not that. I'm on the beta version of gboard (12.4.06.482060964-beta-arm64-v8a) so it may be that. Or it may even be Android as my phone's a Pixel and it had an update a couple of weeks ago.