sadly textarea have its limitation with what am using it, so i had to fallback to contenteditable.

also the funny thing that for an element the cursor doesnt reset, but for another it always goes to start.