File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -280,7 +280,7 @@ const Overlay: FCWithSlotMarker<React.PropsWithChildren<MenuOverlayProps>> = ({
280280 // we typecast anchorRef as required instead of optional
281281 // because we know that we're setting it in context in Menu
282282 const {
283- anchorRef,
283+ anchorRef : contextAnchorRef ,
284284 renderAnchor,
285285 anchorId,
286286 open,
@@ -289,6 +289,9 @@ const Overlay: FCWithSlotMarker<React.PropsWithChildren<MenuOverlayProps>> = ({
289289 isSubmenu = false ,
290290 } = React . useContext ( MenuContext ) as MandateProps < MenuContextProps , 'anchorRef' >
291291
292+ const anchorRef = useRef < HTMLElement > ( null )
293+ const combinedAnchorRef = useCombinedRefs ( anchorRef , contextAnchorRef )
294+
292295 const containerRef = React . useRef < HTMLDivElement > ( null )
293296 const isNarrow = useResponsiveValue ( { narrow : true } , false )
294297
@@ -330,7 +333,7 @@ const Overlay: FCWithSlotMarker<React.PropsWithChildren<MenuOverlayProps>> = ({
330333
331334 return (
332335 < AnchoredOverlay
333- anchorRef = { anchorRef }
336+ anchorRef = { combinedAnchorRef }
334337 renderAnchor = { renderAnchor }
335338 anchorId = { anchorId }
336339 open = { open }
You can’t perform that action at this time.
0 commit comments