web-feature: document.caretPositionFromPoint()

baseline logo Widely available

The document.caretPositionFromPoint() method finds an insertion point, represented by a DOM node and an offset within that node, for given coordinates in the viewport.