diff --git a/public/app/features/dashboard/components/SubMenu/DashboardLinksDashboard.tsx b/public/app/features/dashboard/components/SubMenu/DashboardLinksDashboard.tsx index 576e33330b2..b783570759b 100644 --- a/public/app/features/dashboard/components/SubMenu/DashboardLinksDashboard.tsx +++ b/public/app/features/dashboard/components/SubMenu/DashboardLinksDashboard.tsx @@ -1,4 +1,4 @@ -import React, { useRef, useState } from 'react'; +import React, { useRef, useState, useLayoutEffect } from 'react'; import { Icon, Tooltip } from '@grafana/ui'; import { sanitize, sanitizeUrl } from '@grafana/data/src/text/sanitize'; import { getBackendSrv } from 'app/core/services/backend_srv'; @@ -17,9 +17,14 @@ interface Props { export const DashboardLinksDashboard: React.FC = (props) => { const { link, linkInfo } = props; const listRef = useRef(null); + const [dropdownCssClass, setDropdownCssClass] = useState('invisible'); const [opened, setOpened] = useState(0); const resolvedLinks = useResolvedLinks(props, opened); + useLayoutEffect(() => { + setDropdownCssClass(getDropdownLocationCssClass(listRef.current)); + }, [resolvedLinks]); + if (link.asDropdown) { return ( @@ -33,7 +38,7 @@ export const DashboardLinksDashboard: React.FC = (props) => { {linkInfo.title} -
    +
      {resolvedLinks.length > 0 && resolvedLinks.map((resolvedLink, index) => { return (