Using focus() in JS there means that existing text in the field gets selected. Move the cursor to the end after focusing it to prevent that. Fixes #2359