diff --git a/app/[leaflet_id]/publish/BskyPostEditorProsemirror.tsx b/app/[leaflet_id]/publish/BskyPostEditorProsemirror.tsx index 37c62312..379208f5 100644 --- a/app/[leaflet_id]/publish/BskyPostEditorProsemirror.tsx +++ b/app/[leaflet_id]/publish/BskyPostEditorProsemirror.tsx @@ -148,10 +148,23 @@ export function BlueskyPostEditorProsemirror(props: { const pos = view.state.selection.from; setMentionInsertPos(pos); const coords = view.coordsAtPos(pos - 1); - setMentionCoords({ - top: coords.bottom + window.scrollY, - left: coords.left + window.scrollX, - }); + + // Get coordinates relative to the positioned parent container + const editorEl = view.dom; + const container = editorEl.closest(".relative") as HTMLElement | null; + + if (container) { + const containerRect = container.getBoundingClientRect(); + setMentionCoords({ + top: coords.bottom - containerRect.top, + left: coords.left - containerRect.left, + }); + } else { + setMentionCoords({ + top: coords.bottom, + left: coords.left, + }); + } setMentionOpen(true); }, []); @@ -270,6 +283,7 @@ export function BlueskyPostEditorProsemirror(props: { view={viewRef} onSelect={handleMentionSelect} coords={mentionCoords} + placeholder="Search people..." /> {editorState?.doc.textContent.length === 0 && (