Kanas repeating themselves

Hi

I’ve changed phones recently (different OS, different browser). I usually did my daily routine of reviews on my iPhone. Since I switched to a OnePlus, I’ve noticed a bug when typing kanji readings. When writing in rōmaji, wanikani always transforms the syllables in the correct hiragana. But now it duplicates the first syllable when I try to type the secone one. It’s difficult to explain so I recorded a video.

Any ideas why that happens ?

Thank you (and great platform)

2 Likes

I’ve noticed this happens too on my android phone. I think it’s a bug with the kana input field they’re using, it seems to duplicate whatever was already in the input field the moment it has to convert something to kana. I just ended up switching to a japanese keyboard on my phone instead, if it doesn’t have to convert anything to kana it can’t trigger the bug, and that seems to work fine for me.

3 Likes

I don’t know why, but as for potential fixes, you could use a third-party app like Flaming Durtles, or, you could use a flick keyboard, though that may take some getting used to.

1 Like

Does it work correctly using the input on this website?

http://wanakana.com/

On my phone the issue is also present on that site, so it’s probably a bug with the wanakana library.

I did a bit of debugging to see what triggers the actual problem. It looks like they’re using an input event listener to detect when someone types into the IME box (registered in the libraries main bind function used to attach it to the input box, which uses addEventListener to set up the listener), after which they convert the text in it into kana if the event is triggered. So I made a minimal example to test how it works, using a single HTML page with only a single text input box, and the absolute bare minimum of javascript to set up an event listener and display the results, with the input handler as similar to the one the library uses:

<!DOCTYPE html>
<html>
    <body>
        <input id="ime">
        <script>
            function onInput({target}) {
                alert(target.value);
            }
            var input = document.getElementById("ime");
            input.addEventListener('input', onInput);
        </script>
    </body>
</html>

On my laptop it seems to only trigger the input event once per letter typed, whereas on my phone it seems to trigger it more than once for any character after the first letter entered (usually twice), which I assume is probably triggering the duplication, although I’d have to debug a bit further to make sure.

So it seems to be a bug triggered by the difference in event handling between desktop and mobile browsers (I’ve tested it both on Chrome for Android as Firefox for Android, both seem to have the same multi-event-per-single-letter problem).

2 Likes

This used to happen a long time ago but eventually it got fixed. It started happening to me again on my Android phone sometime within the last two weeks.

1 Like

Main reason I was asking is that the version of the library that WaniKani uses is way out of date. I was hoping it had already been fixed in the library and I could just alert the mods about that fact to encourage them to update to latest. But apparently that won’t help anyway. Thanks for confirming.

2 Likes

Thanks for the suggestion, I will give it a shot

1 Like