Apparently in Safari, setSelectionRange()
will focus the element even when not focused despite MDN stating that “The element must be focused for the call to have any effect”.
According to this bug, this is considered intended behavior even though it’s inconsistent with MDN and the other browsers.
It’s worth noting though, during my testing, I noticed that Chrome/Firefox will update the selection and cursor position you just won’t see it unless you programmatically call .focus()
on the element.