From 03563abba08c21e0d7a75b9c3d8a8f86695831fb Mon Sep 17 00:00:00 2001 From: "Grot (@grafanabot)" <43478413+grafanabot@users.noreply.github.com> Date: Fri, 30 Oct 2020 01:03:16 +0530 Subject: [PATCH] PanelMenu: Fixes panel submenu not being accessible for panels close to the right edge of the screen (#28666) (#28676) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Dropdowns: Trying to fix dropdown menus * Dropdowns: Trying to fix dropdown menus * removed now unnessary wrapper ref * Upodates * Remove export (cherry picked from commit 5a83fc574aaf73a8143f921c84dff6a8b59e0549) Co-authored-by: Torkel Ödegaard --- .../components/SubMenu/DashboardLinks.tsx | 2 +- .../SubMenu/DashboardLinksDashboard.tsx | 48 ++++++++++++------- .../PanelHeader/PanelHeaderMenuItem.tsx | 25 +++++++++- public/sass/components/_dropdown.scss | 12 +++-- public/sass/components/_gf-form.scss | 5 ++ 5 files changed, 68 insertions(+), 24 deletions(-) diff --git a/public/app/features/dashboard/components/SubMenu/DashboardLinks.tsx b/public/app/features/dashboard/components/SubMenu/DashboardLinks.tsx index d733eab69fe..abab921936b 100644 --- a/public/app/features/dashboard/components/SubMenu/DashboardLinks.tsx +++ b/public/app/features/dashboard/components/SubMenu/DashboardLinks.tsx @@ -44,7 +44,7 @@ export const DashboardLinks: FC = ({ dashboard, links }) => { const linkElement = ( { state: State = { resolvedLinks: [] }; - wrapperRef = createRef(); listItemRef = createRef(); componentDidMount() { @@ -45,7 +44,7 @@ export class DashboardLinksDashboard extends PureComponent { const { link } = this.props; return ( -
+
{link.tooltip && {linkElement}} {!link.tooltip && <>{linkElement}}
@@ -62,7 +61,7 @@ export class DashboardLinksDashboard extends PureComponent { resolvedLinks.map((resolvedLink, index) => { const linkElement = (
{ ); }; - getDropdownLocationCssClass = (): string => { - const [pullLeftCssClass, pullRightCssClass] = ['pull-left', 'pull-right']; - const wrapper = this.wrapperRef.current; - const list = this.listItemRef.current; - if (!wrapper || !list) { - return pullRightCssClass; - } - return wrapper.offsetLeft > list.offsetWidth - wrapper.offsetWidth ? pullRightCssClass : pullLeftCssClass; - }; - - renderDropdown = () => { + renderDropdown() { const { link, linkInfo } = this.props; const { resolvedLinks } = this.state; const linkElement = ( <> - + {linkInfo.title} -