mirror of
https://github.com/grafana/grafana.git
synced 2025-08-02 14:43:49 +08:00
DynamicDashboards: Fix scroll positioning when returning to dashboard (#100047)
* fix scroll positioning in new layouts editor * refactor
This commit is contained in:
@ -23,7 +23,7 @@ export default function NativeScrollbar({ children, onSetScrollRef, divId }: Pro
|
||||
return children;
|
||||
}
|
||||
|
||||
class DivScrollElement {
|
||||
export class DivScrollElement implements ScrollRefElement {
|
||||
public constructor(private element: HTMLElement) {}
|
||||
public get scrollTop() {
|
||||
return this.element.scrollTop;
|
||||
|
@ -5,7 +5,7 @@ import { GrafanaTheme2 } from '@grafana/data';
|
||||
import { config, useChromeHeaderHeight } from '@grafana/runtime';
|
||||
import { useSceneObjectState } from '@grafana/scenes';
|
||||
import { ElementSelectionContext, useStyles2 } from '@grafana/ui';
|
||||
import NativeScrollbar from 'app/core/components/NativeScrollbar';
|
||||
import NativeScrollbar, { DivScrollElement } from 'app/core/components/NativeScrollbar';
|
||||
|
||||
import { useSnappingSplitter } from '../panel-edit/splitter/useSnappingSplitter';
|
||||
import { DashboardScene } from '../scene/DashboardScene';
|
||||
@ -68,7 +68,7 @@ export function DashboardEditPaneSplitter({ dashboard, isEditing, body, controls
|
||||
}
|
||||
|
||||
const onBodyRef = (ref: HTMLDivElement) => {
|
||||
dashboard.onSetScrollRef(ref);
|
||||
dashboard.onSetScrollRef(new DivScrollElement(ref));
|
||||
};
|
||||
|
||||
return (
|
||||
|
Reference in New Issue
Block a user