From 646afec49173c166724291f3b9ecdb7736d8c60e Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Sun, 5 Mar 2023 16:03:13 -0500 Subject: [PATCH] fix: Cannot access menu on threaded comments, closes #4983 --- app/editor/components/FloatingToolbar.tsx | 10 ++++++++-- app/scenes/Document/components/CommentThreadItem.tsx | 1 + 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/app/editor/components/FloatingToolbar.tsx b/app/editor/components/FloatingToolbar.tsx index f831e5a57..99f7d0629 100644 --- a/app/editor/components/FloatingToolbar.tsx +++ b/app/editor/components/FloatingToolbar.tsx @@ -141,8 +141,14 @@ function usePosition({ // instances leave a margin const margin = 12; const left = Math.min( - offsetParent.x + offsetParent.width - menuWidth - margin, - Math.max(offsetParent.x + margin, centerOfSelection - menuWidth / 2) + Math.min( + offsetParent.x + offsetParent.width - menuWidth, + window.innerWidth - margin + ), + Math.max( + Math.max(offsetParent.x, margin), + centerOfSelection - menuWidth / 2 + ) ); const top = Math.min( window.innerHeight - menuHeight - margin, diff --git a/app/scenes/Document/components/CommentThreadItem.tsx b/app/scenes/Document/components/CommentThreadItem.tsx index 50850a883..c0698a423 100644 --- a/app/scenes/Document/components/CommentThreadItem.tsx +++ b/app/scenes/Document/components/CommentThreadItem.tsx @@ -243,6 +243,7 @@ export const Bubble = styled(Flex)<{ $focused?: boolean; $dir?: "rtl" | "ltr"; }>` + position: relative; flex-grow: 1; font-size: 15px; color: ${(props) => props.theme.text};