I think the root cause of this is Safari's caretRangeFromPoint returns after the selected node for some reason. Probably needs some kludge.
https://prosemirror.net/examples/prosemirror.js retrieved 12 May 2021
Chrome and Firefox are unaffected
There was a workaround for this already, but it only handled the case where the selected node was the direct parent of the text. Attached patch extends this to work for any selected ancestor nodes.
Most helpful comment
There was a workaround for this already, but it only handled the case where the selected node was the direct parent of the text. Attached patch extends this to work for any selected ancestor nodes.