You can try to add:
window.getSelection().removeAllRanges();
This will solve your issue.
To answer your question: this seems to be a bug of FireFox and needs a workaround. What happens is FireFox messed up the priority of events where focus
is set first, prior to onblur
. Browsers who don't have the bug will not fire the focus event when onblur occurs.