mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Datalinks: Fix context menu position for body scroll (#92389)
* fix(datalinks): position context menu offest to vertical window scroll * feature toggle change * enhance boot data mock with empty featureToggles --------- Co-authored-by: Ashley Harrison <ashley.harrison@grafana.com>
This commit is contained in:
parent
5a30e12a10
commit
c0a719caa7
@ -15,6 +15,7 @@ export interface WithContextMenuProps {
|
||||
export const WithContextMenu = ({ children, renderMenuItems, focusOnOpen = true }: WithContextMenuProps) => {
|
||||
const [isMenuOpen, setIsMenuOpen] = useState(false);
|
||||
const [menuPosition, setMenuPosition] = useState({ x: 0, y: 0 });
|
||||
const isBodyScrolling = window.grafanaBootData?.settings.featureToggles.bodyScrolling;
|
||||
return (
|
||||
<>
|
||||
{children({
|
||||
@ -22,7 +23,7 @@ export const WithContextMenu = ({ children, renderMenuItems, focusOnOpen = true
|
||||
setIsMenuOpen(true);
|
||||
setMenuPosition({
|
||||
x: e.pageX,
|
||||
y: e.pageY,
|
||||
y: isBodyScrolling ? e.pageY - window.scrollY : e.pageY,
|
||||
});
|
||||
},
|
||||
})}
|
||||
|
@ -27,6 +27,7 @@ global.$ = global.jQuery = $;
|
||||
// mock the default window.grafanaBootData settings
|
||||
const settings: Partial<GrafanaBootConfig> = {
|
||||
angularSupportEnabled: true,
|
||||
featureToggles: {},
|
||||
};
|
||||
global.grafanaBootData = {
|
||||
settings,
|
||||
|
Loading…
Reference in New Issue
Block a user