From 36b8eab0b5ed8acd2be816dad85fe92cc908e592 Mon Sep 17 00:00:00 2001 From: Gerard Rovira Date: Mon, 26 Aug 2024 19:28:34 +0100 Subject: [PATCH] =?UTF-8?q?Revert=20"[lexical-playground]=20Fix:=20in=20pl?= =?UTF-8?q?ayground=20show=20component-menu=20w=E2=80=A6=20(#6558)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/lexical-react/src/shared/LexicalMenu.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/lexical-react/src/shared/LexicalMenu.ts b/packages/lexical-react/src/shared/LexicalMenu.ts index 62b0dc8e3a0..590e5cfdc57 100644 --- a/packages/lexical-react/src/shared/LexicalMenu.ts +++ b/packages/lexical-react/src/shared/LexicalMenu.ts @@ -494,7 +494,9 @@ export function useMenuAnchorRef( if (rootElement !== null && resolution !== null) { const {left, top, width, height} = resolution.getRect(); const anchorHeight = anchorElementRef.current.offsetHeight; // use to position under anchor - containerDiv.style.top = `${top + anchorHeight + 3}px`; + containerDiv.style.top = `${ + top + window.pageYOffset + anchorHeight + 3 + }px`; containerDiv.style.left = `${left + window.pageXOffset}px`; containerDiv.style.height = `${height}px`; containerDiv.style.width = `${width}px`; @@ -516,7 +518,9 @@ export function useMenuAnchorRef( top + menuHeight > rootElementRect.bottom) && top - rootElementRect.top > menuHeight + height ) { - containerDiv.style.top = `${top - menuHeight - height}px`; + containerDiv.style.top = `${ + top - menuHeight + window.pageYOffset - height + }px`; } }