diff --git a/src/shared/layouts/MultipleSpacesLayout/components/Header/components/Breadcrumbs/components/BreadcrumbsItem/BreadcrumbsItem.tsx b/src/shared/layouts/MultipleSpacesLayout/components/Header/components/Breadcrumbs/components/BreadcrumbsItem/BreadcrumbsItem.tsx index 7b84a2908..37912d262 100644 --- a/src/shared/layouts/MultipleSpacesLayout/components/Header/components/Breadcrumbs/components/BreadcrumbsItem/BreadcrumbsItem.tsx +++ b/src/shared/layouts/MultipleSpacesLayout/components/Header/components/Breadcrumbs/components/BreadcrumbsItem/BreadcrumbsItem.tsx @@ -39,16 +39,17 @@ const BreadcrumbsItem: FC = (props) => { onClick, } = props; const history = useHistory(); - const [containerRef, { width: containerWidth }] = useMeasure(); + const containerRef = useRef(null); + const [listRef, { width: listWidth }] = useMeasure(); const [buttonRef, { width: buttonWidth }] = useMeasure(); const hasOverlay = useMemo(() => { return ( Math.abs( - Math.floor(containerWidth) - Math.floor(buttonWidth + PADDING), + Math.floor(listWidth) - Math.floor(buttonWidth + PADDING), ) >= OVERLAY_THRESHOLD ); - }, [containerWidth, buttonWidth]); + }, [listWidth, buttonWidth]); const { getCommonPagePath } = useRoutesContext(); const contextMenuRef = useRef(null); @@ -59,37 +60,43 @@ const BreadcrumbsItem: FC = (props) => { onClick?.(); return; } + if (containerRef.current) { + const { x, y, height } = containerRef.current.getBoundingClientRect(); + contextMenuRef.current?.open(x, y + height); + } }; return ( -
  • - - - - - - {activeItem.name} - - - {withMenu && ( - - )} -
  • +
    +
  • + + + + + + {activeItem.name} + + + {withMenu && ( + + )} +
  • +
    ); };