diff --git a/packages/grafana-ui/src/components/PanelChrome/PanelChrome.tsx b/packages/grafana-ui/src/components/PanelChrome/PanelChrome.tsx
index 67ce73c929b..a10057a5cc3 100644
--- a/packages/grafana-ui/src/components/PanelChrome/PanelChrome.tsx
+++ b/packages/grafana-ui/src/components/PanelChrome/PanelChrome.tsx
@@ -1,5 +1,5 @@
import { css, cx } from '@emotion/css';
-import { CSSProperties, ReactElement, ReactNode, useId, useState } from 'react';
+import { CSSProperties, PropsWithChildren, ReactElement, ReactNode, useId, useState } from 'react';
import * as React from 'react';
import { useMeasure, useToggle } from 'react-use';
@@ -110,6 +110,11 @@ interface HoverHeader {
hoverHeaderOffset?: number;
}
+const MaybeWrap = ({ children }: PropsWithChildren<{}>) => {
+ const styles = useStyles2(getStyles);
+ return getFeatureToggle('preventPanelChromeOverflow') ?
{children}
: children;
+};
+
/**
* @internal
*/
@@ -336,104 +341,106 @@ export function PanelChrome({
const hasHeaderContent = title || description || titleItems || menu || dragClass || actions;
return (
- // tabIndex={0} is needed for keyboard accessibility in the plot area
-
-
- {loadingState === LoadingState.Loading ? (
-
- ) : null}
-
-
- {hoverHeader && (
- <>
- {hasHeaderContent && (
-
- {headerContent}
-
- )}
-
- {statusMessage && (
-
- )}
- >
- )}
-
- {hasHeader && (
-
- {statusMessage && (
-
- )}
-
- {headerContent}
-
- {menu && (
-
+ {/* tabIndex={0} is needed for keyboard accessibility in the plot area */}
+
+
+ {loadingState === LoadingState.Loading ? (
+
- )}
+ ) : null}
- )}
- {!collapsed && (
-
- {typeof children === 'function' ? children(innerWidth, innerHeight) : children}
-
- )}
-
+ {hoverHeader && (
+ <>
+ {hasHeaderContent && (
+
+ {headerContent}
+
+ )}
+
+ {statusMessage && (
+
+ )}
+ >
+ )}
+
+ {hasHeader && (
+
+ {statusMessage && (
+
+ )}
+
+ {headerContent}
+
+ {menu && (
+
+ )}
+
+ )}
+
+ {!collapsed && (
+
+ {typeof children === 'function' ? children(innerWidth, innerHeight) : children}
+
+ )}
+
+
);
}
@@ -494,10 +501,13 @@ const getStyles = (theme: GrafanaTheme2) => {
return {
container: css({
+ position: 'relative',
+ }),
+ panel: css({
label: 'panel-container',
backgroundColor: background,
border: `1px solid ${borderColor}`,
- position: 'relative',
+ position: getFeatureToggle('preventPanelChromeOverflow') ? 'unset' : 'relative',
borderRadius: theme.shape.radius.default,
height: '100%',
display: 'flex',
@@ -534,7 +544,7 @@ const getStyles = (theme: GrafanaTheme2) => {
},
},
}),
- transparentContainer: css({
+ panelTransparent: css({
label: 'panel-transparent-container',
backgroundColor: 'transparent',
border: '1px solid transparent',