diff --git a/web/src/components/content/ContentComposer/plugins/MenuPlugin.tsx b/web/src/components/content/ContentComposer/plugins/MenuPlugin.tsx index 048418bc1..81cff9f7a 100644 --- a/web/src/components/content/ContentComposer/plugins/MenuPlugin.tsx +++ b/web/src/components/content/ContentComposer/plugins/MenuPlugin.tsx @@ -111,12 +111,17 @@ export class FloatingMenuView { return; } - const { top: containerTop } = view.dom.getBoundingClientRect(); + const { top: containerTop, left: containerLeft } = + view.dom.getBoundingClientRect(); const { bottom: caretY } = posToDOMRect(view, from, to); - const offsetY = caretY - containerTop + 16; + const offsetY = caretY + 16; + const offsetX = containerLeft; // NOTE: Left is -1px for optical alignment due to the border radius. - this.element.setAttribute("style", `top: ${offsetY}px; left: -1px;`); + this.element.setAttribute( + "style", + `top: ${offsetY}px; left: ${offsetX - 1}px;`, + ); } hide() {