From 1a0a8c73e2dfef6b7733290c8c49e3b99e37cef3 Mon Sep 17 00:00:00 2001 From: Rachel Shen Date: Tue, 15 Oct 2024 13:10:36 -0600 Subject: [PATCH] [8.15] [Dashboard] [Usability] Add scroll margin to panels (#193430) (#196382) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit # Backport This will backport the following commits from `main` to `8.15`: - [[Dashboard] [Usability] Add scroll margin to panels (#193430)](https://github.com/elastic/kibana/pull/193430) ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) --- .../component/grid/_dashboard_panel.scss | 7 +++++++ .../component/grid/dashboard_grid_item.tsx | 2 +- .../dashboard_container/embeddable/dashboard_container.tsx | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) 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 d4fd84618747d..28788f38826f5 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 @@ -53,7 +53,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, diff --git a/src/plugins/dashboard/public/dashboard_container/embeddable/dashboard_container.tsx b/src/plugins/dashboard/public/dashboard_container/embeddable/dashboard_container.tsx index 45f3b2535ff6d..23052bd094e82 100644 --- a/src/plugins/dashboard/public/dashboard_container/embeddable/dashboard_container.tsx +++ b/src/plugins/dashboard/public/dashboard_container/embeddable/dashboard_container.tsx @@ -784,7 +784,7 @@ export class DashboardContainer return; } - panelRef.scrollIntoView({ block: 'center' }); + panelRef.scrollIntoView({ block: 'nearest' }); }); };