Low Severity WanaKana Bugs

I am seeing a bug with all scripts disabled where the WanaKana library’s unbind() method is being called even in cases where it is not bound to the answer textbox, such as after a meaning item is answered. This results in a warning being logged to the console.

Another big annoyance (bug?) with WanaKana is that the cursor always moves to the end of the text whenever a mora is converted. So if I type う, then move my cursor to before う and type ちが, then instead of getting ちがう like I would expect, I get ちうが.


Edit: It seems like you may have recently changed something that makes the second bug harder to trigger, but it can still be triggered by following the instructions here and at least one other person has confirmed this. Even though the bug happens less often now, the cursor flickering to the end is still annoying, so it would be nice if it is fixed.

Edit 2: I did some checking, and it looks like it is possible to change the value of a text input and simultaneously update the cursor position without any race condition and without the cursor flashing to the end.

Edit 3: I think I found the code that is causing this bug:

// WanaKana/blob/master/src/utils/dom.js
// line 42
 if (tail.length) {
      // push later on event loop (otherwise mid-text insertion can be 1 char too far to the right)
      setTimeout(() => target.setSelectionRange(newCursor, newCursor), 1);

I think if you made this call synchronous and robustly fixed the root cause of the off by 1 insertion error (instead of using the setTimeout hack), this would fix the issue.


I could not reproduce this on Linux or Windows, using Firefox or Chrome

I just checked again and it’s harder for me to reproduce now than it used to be but I can still reproduce the issue as follows. (Maybe they changed something recently?)

  1. type ああ
  2. move the cursor between the two あ’s.
  3. repeatedly mash on the keyboard very quickly
  4. a small amount of the text will be after the second あ.

It used to be the text was always at the end, but now it seems like they try to relocate the cursor but whatever they are doing has a race condition.

I couldn’t replicate this on Chrome in MacOS, but I can see how the cursor is moving to the end of the line and back

It’s easier to reproduce if you open up developer tools, go to performance, click the gear icon, and select throttling → 6x slowdown. Also, the way you mash the keys affects reproducibility too. I find best results by placing both hands on the home row in the standard typing position and then simultaneously pressing and releasing all keys in the home with both hands as fast as possible repeatedly for 5 full seconds.

1 Like

I can also confirm that this has happened to me before.

Same, caret flickers, sometimes it’s annoying
however when trying to reproduce on purpose it takes real key smashing for letters to teleport to the end

So you have to be really quick to send the cursor to the back. Is this caused by some JS latency or something similar?


reaching lvl 30 one radical was automatically done for me:

Kind regards,

When you type a mora in romaji, they update the text in the answer prompt to replace the romaji with the hiragana. Doing this causes the cursor to be sent to the end. They then move the cursor back to where it is supposed to be, but for some reason, instead of doing this immediately, it appears that they wait. This small period of time where the cursor is at the end appears to be what is causing the issue. If they moved the cursor immediately after updating the input, I believe this would solve the problems of both the cursor flashing to the end and the possibility of text getting entered at the end instead of the middle.

You might be able to increase the chance of getting a response to your issue by starting a new thread and tagging the mods, since this current thread is about bugs related to WanaKana (WaniKani’s IME).

Thanks, we’ll look into it although it’s probably a bit lower priority at the moment.


I’m guessing it’s the hills radical because we moved that item a few months ago.


Thanks. Another unrelated minor issue I am seeing is that on the lessons page, if you type something that makes the answer bar shake, a horizontal scroll bar will appear and then flicker at the bottom of the page. (Tested with all scripts disabled.)


I guess this is as good a thread (or as bad) as any to ask this but: What does “est fills cando” mean?

1 Like

It’s just gibberish. :slight_smile:

1 Like

This should be fixed this morning.

Thanks! It looks like only the first issue is fixed. The second issue (mentioned here) still seems to be present.

Yes, it’s just the first issue I was quoting.

1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.