Fix caret positioning bug in firefox.