-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Fix: menu popup can not be closed again #35452
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
bf40b7c
3897a62
424c7c6
359379b
0eba5a2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -65,7 +65,7 @@ function PopoverReportActionContextMenu(_props: never, ref: ForwardedRef<ReportA | |||||||||
const [disabledActions, setDisabledActions] = useState<ContextMenuAction[]>([]); | ||||||||||
|
||||||||||
const contentRef = useRef<View>(null); | ||||||||||
const anchorRef = useRef<View | HTMLDivElement>(null); | ||||||||||
const anchorRef = useRef<HTMLDivElement | null>(null); | ||||||||||
const dimensionsEventListener = useRef<EmitterSubscription | null>(null); | ||||||||||
const contextMenuAnchorRef = useRef<ContextMenuAnchor | null>(null); | ||||||||||
const contextMenuTargetNode = useRef<HTMLElement | null>(null); | ||||||||||
|
@@ -163,11 +163,14 @@ function PopoverReportActionContextMenu(_props: never, ref: ForwardedRef<ReportA | |||||||||
isPinnedChat = false, | ||||||||||
isUnreadChat = false, | ||||||||||
disabledOptions = [], | ||||||||||
isThreeDotButton = false, | ||||||||||
tienifr marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||
) => { | ||||||||||
const {pageX = 0, pageY = 0} = extractPointerEvent(event); | ||||||||||
contextMenuAnchorRef.current = contextMenuAnchor; | ||||||||||
contextMenuTargetNode.current = event.target as HTMLElement; | ||||||||||
|
||||||||||
if (isThreeDotButton) { | ||||||||||
anchorRef.current = event.target as HTMLDivElement; | ||||||||||
} | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Then control the prop value based on the new prop. anchorRef={shouldCloseOnTarget && anchorRef} There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we should
and keep anchorRef = {anchorRef} to avoid changing anchorRef type There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @parasharrajat wdyt? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am not fully sold on this. IMO, anchorRef should always be set and we should control if we want to close the menu on target via a different way. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's see what Internal Engineer has to say about this. |
||||||||||
setInstanceID(Math.random().toString(36).substr(2, 5)); | ||||||||||
|
||||||||||
onPopoverShow.current = onShow; | ||||||||||
|
Uh oh!
There was an error while loading. Please reload this page.