diff --git a/public/app/features/dashboard/panel_editor/VisualizationTab.tsx b/public/app/features/dashboard/panel_editor/VisualizationTab.tsx index ad569a9ff90..64bf3165ddc 100644 --- a/public/app/features/dashboard/panel_editor/VisualizationTab.tsx +++ b/public/app/features/dashboard/panel_editor/VisualizationTab.tsx @@ -26,6 +26,7 @@ interface Props { interface State { isVizPickerOpen: boolean; searchQuery: string; + scrollTop: number; } export class VisualizationTab extends PureComponent { @@ -39,6 +40,7 @@ export class VisualizationTab extends PureComponent { this.state = { isVizPickerOpen: false, searchQuery: '', + scrollTop: 0, }; } @@ -143,7 +145,7 @@ export class VisualizationTab extends PureComponent { }; onOpenVizPicker = () => { - this.setState({ isVizPickerOpen: true }); + this.setState({ isVizPickerOpen: true, scrollTop: 0 }); }; onCloseVizPicker = () => { @@ -201,9 +203,14 @@ export class VisualizationTab extends PureComponent { renderHelp = () => ; + setScrollTop = (event: React.MouseEvent) => { + const target = event.target as HTMLElement; + this.setState({ scrollTop: target.scrollTop }); + }; + render() { const { plugin } = this.props; - const { isVizPickerOpen, searchQuery } = this.state; + const { isVizPickerOpen, searchQuery, scrollTop } = this.state; const pluginHelp: EditorToolbarView = { heading: 'Help', @@ -212,7 +219,8 @@ export class VisualizationTab extends PureComponent { }; return ( - + <>