diff --git a/src/plugins/dashboard/public/dashboard_api/track_panel.ts b/src/plugins/dashboard/public/dashboard_api/track_panel.ts index 3f3a9b4aaad4b..42345f38d614f 100644 --- a/src/plugins/dashboard/public/dashboard_api/track_panel.ts +++ b/src/plugins/dashboard/public/dashboard_api/track_panel.ts @@ -73,8 +73,7 @@ export function initializeTrackPanel(untilEmbeddableLoaded: (id: string) => Prom }; return; } - - panelRef.scrollIntoView({ block: 'center' }); + panelRef.scrollIntoView({ block: 'nearest' }); }); }, scrollToTop: () => { diff --git a/src/plugins/dashboard/public/dashboard_container/component/grid/_dashboard_panel.scss b/src/plugins/dashboard/public/dashboard_container/component/grid/_dashboard_panel.scss index 5a252f9bf1630..d54f513a207a4 100644 --- a/src/plugins/dashboard/public/dashboard_container/component/grid/_dashboard_panel.scss +++ b/src/plugins/dashboard/public/dashboard_container/component/grid/_dashboard_panel.scss @@ -4,6 +4,11 @@ * .embPanel--editing doesn't get updating without a hard refresh */ +.dshDashboardGrid__item { + scroll-margin-top: calc((var(--euiFixedHeadersOffset, 100) * 2) + $euiSizeS); + scroll-margin-bottom: $euiSizeS; +} + // LAYOUT MODES // Adjust borders/etc... for non-spaced out and expanded panels .dshLayout-withoutMargins { @@ -36,9 +41,11 @@ 0% { outline: solid $euiSizeXS transparentize($euiColorSuccess, 1); } + 25% { outline: solid $euiSizeXS transparentize($euiColorSuccess, .5); } + 100% { outline: solid $euiSizeXS transparentize($euiColorSuccess, 1); } diff --git a/src/plugins/dashboard/public/dashboard_container/component/grid/dashboard_grid_item.tsx b/src/plugins/dashboard/public/dashboard_container/component/grid/dashboard_grid_item.tsx index 518b009571e27..7b21db4ea3f84 100644 --- a/src/plugins/dashboard/public/dashboard_container/component/grid/dashboard_grid_item.tsx +++ b/src/plugins/dashboard/public/dashboard_container/component/grid/dashboard_grid_item.tsx @@ -60,7 +60,7 @@ export const Item = React.forwardRef( const hidePanel = expandedPanelId !== undefined && expandedPanelId !== id; const focusPanel = focusedPanelId !== undefined && focusedPanelId === id; const blurPanel = focusedPanelId !== undefined && focusedPanelId !== id; - const classes = classNames({ + const classes = classNames('dshDashboardGrid__item', { 'dshDashboardGrid__item--expanded': expandPanel, 'dshDashboardGrid__item--hidden': hidePanel, 'dshDashboardGrid__item--focused': focusPanel,