Fix issue with caret position on focus