Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Dashboard Usability] Moves scrollbar to panel section #145628

Merged
merged 67 commits into from
Feb 9, 2023
Merged
Show file tree
Hide file tree
Changes from 58 commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
00fdc98
Moved scroll from entire app page to only panel section
cqliu1 Nov 17, 2022
83fd7ad
Fixed cut off floating actions
cqliu1 Dec 20, 2022
b96acc0
Removed unused import
cqliu1 Dec 20, 2022
d52a748
Delete unused file
cqliu1 Dec 20, 2022
e6e12f5
Enable shadow effect on top border of panel section
cqliu1 Dec 20, 2022
d9a6083
Clean up styles
cqliu1 Dec 20, 2022
c766516
Extracted floating actions component
cqliu1 Jan 9, 2023
94fb0a8
Merge branch 'main' of https://github.com/elastic/kibana into dashboa…
cqliu1 Jan 9, 2023
a7be283
Updated snapshots
cqliu1 Jan 10, 2023
550c9e2
Fix ts errors
cqliu1 Jan 10, 2023
6db3151
Merge branch 'main' of https://github.com/elastic/kibana into dashboa…
cqliu1 Jan 10, 2023
96878e9
Undo lazy loading
cqliu1 Jan 12, 2023
8e52180
Updated snapshots
cqliu1 Jan 12, 2023
a29b956
Fixed a11y tests
cqliu1 Jan 12, 2023
5ae15c7
Update snapshots
cqliu1 Jan 12, 2023
0c56299
Merge branch 'main' of https://github.com/elastic/kibana into dashboa…
cqliu1 Jan 17, 2023
0c67558
Merge branch 'main' of https://github.com/elastic/kibana into dashboa…
cqliu1 Jan 18, 2023
7657bb4
Merge branch 'main' of https://github.com/elastic/kibana into dashboa…
cqliu1 Jan 23, 2023
0c2fe97
Fix options list test
cqliu1 Jan 24, 2023
de92647
Remove test.only
cqliu1 Jan 24, 2023
0c95ec0
[CI] Auto-commit changed files from 'node scripts/eslint --no-cache -…
kibanamachine Jan 24, 2023
f4e21af
Merge branch 'main' of https://github.com/elastic/kibana into dashboa…
cqliu1 Jan 30, 2023
27677e4
Update snapshot
cqliu1 Jan 30, 2023
7296356
Merge branch 'dashboard/move-scrollbar' of https://github.com/cqliu1/…
cqliu1 Jan 30, 2023
99a7bf0
Fix saved searches tests
cqliu1 Jan 30, 2023
87c9860
Fixed scrolling for maximized panel
cqliu1 Jan 30, 2023
108a30b
Updated baseline
cqliu1 Jan 31, 2023
9ef7013
Merge branch 'main' of https://github.com/elastic/kibana into dashboa…
cqliu1 Jan 31, 2023
9b9107a
Fix map tests
cqliu1 Jan 31, 2023
69c3bb2
Updated snapshots
cqliu1 Jan 31, 2023
460fbd7
Fix extra white space for small dashboard reports
cqliu1 Feb 2, 2023
05bf2cf
Merge branch 'main' of https://github.com/elastic/kibana into dashboa…
cqliu1 Feb 2, 2023
c4f813f
Fixed options list tests
cqliu1 Feb 2, 2023
5133101
Remove .only
cqliu1 Feb 2, 2023
f9d3547
Fix lint error
cqliu1 Feb 2, 2023
7b52925
Merge branch 'main' of https://github.com/elastic/kibana into dashboa…
cqliu1 Feb 2, 2023
e549031
Update area chart snapshot
cqliu1 Feb 3, 2023
6f0201a
Fixed range slider tests
cqliu1 Feb 3, 2023
95f8993
Merge branch 'main' of https://github.com/elastic/kibana into dashboa…
cqliu1 Feb 3, 2023
3654233
Wrapped exit fullscreen button with EuiPortal
cqliu1 Feb 3, 2023
5389c4f
Cleanup
cqliu1 Feb 3, 2023
5d61a4e
Revert area and tsvb chart snapshot changes
cqliu1 Feb 3, 2023
160fe90
More cleanup
cqliu1 Feb 3, 2023
e3b7c1a
Removed unused prop
cqliu1 Feb 3, 2023
aa91500
Merge branch 'main' into dashboard/move-scrollbar
cqliu1 Feb 6, 2023
6d7683f
Merge branch 'main' of https://github.com/elastic/kibana into dashboa…
cqliu1 Feb 6, 2023
b8c0d93
Add repositionOnScroll flag to popovers
cqliu1 Feb 6, 2023
2ccc09c
Merge branch 'dashboard/move-scrollbar' of https://github.com/cqliu1/…
cqliu1 Feb 6, 2023
a62db98
Merge branch 'main' of https://github.com/elastic/kibana into dashboa…
cqliu1 Feb 6, 2023
acbf6c0
Reduce top/bottom padding on solution toolbar
cqliu1 Feb 6, 2023
098fa6e
Added top padding to control group
cqliu1 Feb 6, 2023
f5d9185
Update maps tooltip popover snapshots
cqliu1 Feb 6, 2023
dbc5024
Merge branch 'main' into dashboard/move-scrollbar
cqliu1 Feb 6, 2023
87a9a80
Merge branch 'main' into dashboard/move-scrollbar
cqliu1 Feb 6, 2023
c19bf2f
Add top padding to controls
cqliu1 Feb 6, 2023
84495f3
Merge branch 'dashboard/move-scrollbar' of https://github.com/cqliu1/…
cqliu1 Feb 6, 2023
5914895
Merge branch 'main' of https://github.com/elastic/kibana into dashboa…
cqliu1 Feb 7, 2023
2b3414f
Merge branch 'main' into dashboard/move-scrollbar
cqliu1 Feb 8, 2023
2bcc0ce
Added horizontal rule separate panels from filter bars
cqliu1 Feb 8, 2023
f1ad633
Fixes dual scrollbars in small viewport
cqliu1 Feb 8, 2023
011e2fe
Merge branch 'dashboard/move-scrollbar' of https://github.com/cqliu1/…
cqliu1 Feb 8, 2023
ab51a19
Reduce padding top of dashboard editor toolbar
cqliu1 Feb 8, 2023
06f05ee
Update controls snapshots
cqliu1 Feb 9, 2023
8e714c1
Merge branch 'main' of https://github.com/elastic/kibana into dashboa…
cqliu1 Feb 9, 2023
ee7ffa4
Remove breakpoints
cqliu1 Feb 9, 2023
4d797ef
Merge branch 'main' of https://github.com/elastic/kibana into dashboa…
cqliu1 Feb 9, 2023
1219623
Fix lint error
cqliu1 Feb 9, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {

import { FormattedMessage } from '@kbn/i18n-react';
import { Markdown } from '@kbn/kibana-react-plugin/public';
import { useReduxEmbeddableContext } from '@kbn/presentation-util-plugin/public';
import { useReduxEmbeddableContext, FloatingActions } from '@kbn/presentation-util-plugin/public';
import { ControlGroupReduxState } from '../types';
import { pluginServices } from '../../services';
import { EditControlButton } from '../editor/edit_control';
Expand Down Expand Up @@ -127,12 +127,7 @@ export const ControlFrame = ({
}, [embeddable, embeddableRoot]);

const floatingActions = (
<div
className={classNames('controlFrameFloatingActions', {
'controlFrameFloatingActions--twoLine': usingTwoLineLayout,
'controlFrameFloatingActions--oneLine': !usingTwoLineLayout,
})}
>
<>
{!fatalError && embeddableType !== TIME_SLIDER_CONTROL && (
<EuiToolTip content={ControlGroupStrings.floatingActions.getEditButtonTitle()}>
<EditControlButton embeddableId={embeddableId} />
Expand All @@ -158,7 +153,7 @@ export const ControlFrame = ({
color="danger"
/>
</EuiToolTip>
</div>
</>
);

const embeddableParentClassNames = classNames('controlFrame__control', {
Expand Down Expand Up @@ -220,18 +215,27 @@ export const ControlFrame = ({

return (
<>
{embeddable && enableActions && floatingActions}
<EuiFormRow
data-test-subj="control-frame-title"
fullWidth
label={
usingTwoLineLayout
? title || ControlGroupStrings.emptyState.getTwoLineLoadingTitle()
: undefined
}
<FloatingActions
className={classNames('controlFrameFloatingActions', {
'controlFrameFloatingActions--twoLine': usingTwoLineLayout,
'controlFrameFloatingActions--oneLine': !usingTwoLineLayout,
})}
usingTwoLineLayout={usingTwoLineLayout}
actions={floatingActions}
isEnabled={embeddable && enableActions}
>
{form}
</EuiFormRow>
<EuiFormRow
data-test-subj="control-frame-title"
fullWidth
label={
usingTwoLineLayout
? title || ControlGroupStrings.emptyState.getTwoLineLoadingTitle()
: undefined
}
>
{form}
</EuiFormRow>
</FloatingActions>
</>
);
};
61 changes: 19 additions & 42 deletions src/plugins/controls/public/control_group/control_group.scss
Original file line number Diff line number Diff line change
Expand Up @@ -181,48 +181,6 @@ $controlMinWidth: $euiSize * 14;
}
}

.controlFrameFloatingActions {
visibility: hidden;
opacity: 0;

// slower transition on hover leave in case the user accidentally stops hover
transition: visibility .3s, opacity .3s;

z-index: 1;
position: absolute;

&--oneLine {
right: $euiSizeXS;
top: -$euiSizeL;
padding: $euiSizeXS;
border-radius: $euiBorderRadius;
background-color: $euiColorEmptyShade;
box-shadow: 0 0 0 1px $euiColorLightShade;
}

&--fatalError {
right: $euiSizeXS;
top: -$euiSizeL;
padding: $euiSizeXS;
border-radius: $euiBorderRadius;
background-color: $euiColorEmptyShade;
box-shadow: 0 0 0 1px $euiColorLightShade;
}

&--twoLine {
right: $euiSizeXS;
top: -$euiSizeXS;
}
}

&:hover {
.controlFrameFloatingActions {
transition: visibility .1s, opacity .1s;
visibility: visible;
opacity: 1;
}
}

&-isDragging {
.euiFormRow__labelWrapper {
opacity: 0;
Expand All @@ -232,3 +190,22 @@ $controlMinWidth: $euiSize * 14;
}
}
}

.controlFrameFloatingActions {
z-index: 1;
position: absolute;

&--oneLine {
padding: $euiSizeXS;
border-radius: $euiBorderRadius;
background-color: $euiColorEmptyShade;
box-shadow: 0 0 0 1px $euiColorLightShade;
}

&--fatalError {
padding: $euiSizeXS;
border-radius: $euiBorderRadius;
background-color: $euiColorEmptyShade;
box-shadow: 0 0 0 1px $euiColorLightShade;
}
}
10 changes: 10 additions & 0 deletions src/plugins/dashboard/public/dashboard_app/_dashboard_app.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
@import 'src/core/public/mixins';

.dshAppWrapper {
@include euiBreakpoint('m', 'l', 'xl') {
@include kibanaFullBodyHeight();
}
Copy link
Contributor

@MichaelMarcialis MichaelMarcialis Feb 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excluding the kibanaFullBodyHeight mixin from the s breakpoint appears to be causing dueling scrollbars to appear at small viewport sizes. Fixed in f1ad633.

image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh nice catch! I added a xs too because I was still seeing the dual scrollbar when I shrank the viewport width even more.

Screenshot 2023-02-08 at 12 13 16 PM

display: flex;
flex-direction: column;
}

.dshUnsavedListingItem {
margin-top: $euiSizeM;
}
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/dashboard/public/dashboard_app/dashboard_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ export function DashboardApp({
}, [dashboardContainer, kbnUrlStateStorage]);

return (
<>
<div className={'dshAppWrapper'}>
{showNoDataPage && (
<DashboardAppNoDataPage onDataViewCreated={() => setShowNoDataPage(false)} />
)}
Expand All @@ -204,6 +204,6 @@ export function DashboardApp({
/>
</>
)}
</>
</div>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
@import './component/panel/index';
@import './component/viewport/index';

.dashboardViewport {
flex: 1;
.dashboardContainer, .dashboardViewport {
display: flex;
flex: 1;
flex-direction: column;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@
*/
.dshLayout-isMaximizedPanel {
height: 100% !important; /* 1. */
width: 100%;
position: absolute !important; /* 1 */
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

.dshDashboardViewport-controls {
margin: 0 $euiSizeS 0 $euiSizeS;
padding-bottom: $euiSizeXS;
padding: $euiSizeXS 0;
}

.dshDashboardEmptyScreen {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,21 @@ import React, { useEffect, useRef } from 'react';
import { ViewMode } from '@kbn/embeddable-plugin/public';
import { ExitFullScreenButton } from '@kbn/shared-ux-button-exit-full-screen';

import { css } from '@emotion/react';
import { EuiPortal } from '@elastic/eui';
import { DashboardGrid } from '../grid';
import { pluginServices } from '../../../services/plugin_services';
import { DashboardEmptyScreen } from '../empty_screen/dashboard_empty_screen';
import { useDashboardContainerContext } from '../../dashboard_container_renderer';

export const DashboardViewport = () => {
export const DashboardViewportComponent = () => {
const {
settings: { isProjectEnabledInLabs },
} = pluginServices.getServices();
const controlsRoot = useRef(null);

const {
useEmbeddableDispatch,
useEmbeddableSelector: select,
actions: { setFullScreenMode },
embeddableInstance: dashboardContainer,
} = useDashboardContainerContext();
const dispatch = useEmbeddableDispatch();
const { useEmbeddableSelector: select, embeddableInstance: dashboardContainer } =
useDashboardContainerContext();

/**
* Render Control group
Expand All @@ -47,9 +44,10 @@ export const DashboardViewport = () => {
const dashboardTitle = select((state) => state.explicitInput.title);
const useMargins = select((state) => state.explicitInput.useMargins);
const description = select((state) => state.explicitInput.description);
const isFullScreenMode = select((state) => state.componentState.fullScreenMode);
const isEmbeddedExternally = select((state) => state.componentState.isEmbeddedExternally);

const expandedPanelId = select((state) => state.componentState.expandedPanelId);
const expandedPanelStyles = css`
flex: 1;
`;
const controlsEnabled = isProjectEnabledInLabs('labs:dashboard:dashboardControls');

return (
Expand All @@ -66,13 +64,8 @@ export const DashboardViewport = () => {
data-title={dashboardTitle}
data-description={description}
className={useMargins ? 'dshDashboardViewport-withMargins' : 'dshDashboardViewport'}
css={expandedPanelId ? expandedPanelStyles : undefined}
>
{isFullScreenMode && (
<ExitFullScreenButton
onExit={() => dispatch(setFullScreenMode(false))}
toggleChrome={!isEmbeddedExternally}
/>
)}
{panelCount === 0 && (
<div className="dshDashboardEmptyScreen">
<DashboardEmptyScreen isEditMode={viewMode === ViewMode.EDIT} />
Expand All @@ -83,3 +76,38 @@ export const DashboardViewport = () => {
</>
);
};

// This fullscreen button HOC separates fullscreen button and dashboard content to reduce rerenders
// because ExitFullScreenButton sets isFullscreenMode to false on unmount while rerendering.
// This specifically fixed maximizing/minimizing panels without exiting fullscreen mode.
nickpeihl marked this conversation as resolved.
Show resolved Hide resolved
const WithFullScreenButton = ({ children }: { children: JSX.Element }) => {
const {
useEmbeddableDispatch,
useEmbeddableSelector: select,
actions: { setFullScreenMode },
} = useDashboardContainerContext();
const dispatch = useEmbeddableDispatch();

const isFullScreenMode = select((state) => state.componentState.fullScreenMode);
const isEmbeddedExternally = select((state) => state.componentState.isEmbeddedExternally);

return (
<>
{children}
{isFullScreenMode && (
<EuiPortal>
<ExitFullScreenButton
onExit={() => dispatch(setFullScreenMode(false))}
toggleChrome={!isEmbeddedExternally}
/>
</EuiPortal>
)}
</>
);
};

export const DashboardViewport = () => (
<WithFullScreenButton>
<DashboardViewportComponent />
</WithFullScreenButton>
);
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@ import './_dashboard_container.scss';

import { v4 as uuidv4 } from 'uuid';
import classNames from 'classnames';
import { EuiLoadingElastic, EuiLoadingSpinner } from '@elastic/eui';
import React, { useEffect, useMemo, useRef, useState } from 'react';

import useObservable from 'react-use/lib/useObservable';

import { EuiLoadingElastic, EuiLoadingSpinner, useEuiOverflowScroll } from '@elastic/eui';
import { css } from '@emotion/react';
import { useReduxEmbeddableContext } from '@kbn/presentation-util-plugin/public';

import {
Expand Down Expand Up @@ -110,13 +111,20 @@ export const DashboardContainerRenderer = ({
{ 'dashboardViewport--screenshotMode': isScreenshotMode() },
{ 'dashboardViewport--loading': loading }
);

const viewportStyles = css`
${useEuiOverflowScroll('y', true)}
`;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice use of useEuiOverflowScroll 💯 .

Nit. The overflow creates a blurry gradient on the viewport that maybe shouldn't appear when the viewport is at the top of the page. Would increasing the padding on the viewport fix this?

Screenshot 2023-02-06 at 11 05 57 AM

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is adding padding the best solution here? Ideally we wouldn't want to change the look of the dashboard like that. Plus, the gutter created by the tops of the Controls is roughly the same as the gutter between the elements of the Unified Search bar. @andreadelrio, thoughts on this?

Maybe there's some way to remove the fade

Copy link
Contributor Author

@cqliu1 cqliu1 Feb 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can just remove the blur by not passing true as the 2nd parameter to useEuiOverflowScroll, but it looks a little odd when you're scrolled in the middle of the page without the blur.

I think adding 4px top padding to the controls is sufficient to offset the blur, but if we don't want the additional height added, I can remove the blur.

Here are some screenshots to compare:

Extra top padding

without adding top padding

Screenshot 2023-02-06 at 1 26 19 PM

with 4px top padding

Screenshot 2023-02-06 at 1 21 52 PM

Blur vs no blur

with blur, scroll midway down the dashboard

Screenshot 2023-02-06 at 1 30 36 PM

no blur, scroll midway down the dashboard

Screenshot 2023-02-06 at 1 28 54 PM

Copy link
Contributor

@Heenawter Heenawter Feb 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Crazy idea, but could we add a scroll listener that removes the blur only when at the top? Similar to the scroll listener that was added for options list suggestions. Might be overkill though 🤷

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is adding padding the best solution here? Ideally we wouldn't want to change the look of the dashboard like that.

Padding the top and bottom is recommended by EUI. But we could also just remove the mask as Catherine suggested. I don't feel strongly either way.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that the border doesn't work too well when the page is at the top. In view mode, the border when the page is at the top makes the Controls look very separate from the filter context, which I suppose is somewhat true.

In edit mode, having two borders like that in quick succession is also strange, maybe we leave the border in place, but we don't put the border under the unified search bar in edit mode, and only show the one under the editor?

Copy link
Contributor Author

@cqliu1 cqliu1 Feb 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ThomThomson you mean like this with only the bottom bar? @MichaelMarcialis What do you think?

only bottom border

Screenshot 2023-02-08 at 12 24 39 PM

borders between every bar

Screenshot 2023-02-08 at 11 48 50 AM

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I would say that looks better. The whole pinned section gets one border at the bottom! What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah the extra lines do look pretty busy, but without the border between the two bars, the spacing looks a little tall compared to the other padding on the page, so I think I'll also reduce some padding like this:

Screenshot 2023-02-08 at 1 08 00 PM

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like @ThomThomson's suggestion here for the single border in edit mode. Looks like you've already implemented it, so thumbs up from me!


const loadingSpinner = showPlainSpinner ? (
<EuiLoadingSpinner size="xxl" />
) : (
<EuiLoadingElastic size="xxl" />
);
return (
<div className={viewportClasses}>{loading ? loadingSpinner : <div ref={dashboardRoot} />}</div>
<div className={viewportClasses} css={viewportStyles}>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if related to this change. But the open context menu on panels does not scroll with the dashboard anymore. Adding repositionOnScroll prop to the EuiPopover in src/plugins/embeddable/public/lib/panel/panel_header/panel_options_menu.tsx might fix this.

Copy link
Contributor Author

@cqliu1 cqliu1 Feb 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh that's a handy prop! I added the prop to the popover in the maps embeddable tooltip too, and it fixed the scrolling issue there as well.

Feb-06-2023 11-16-11

{loading ? loadingSpinner : <div ref={dashboardRoot} />}
</div>
);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,8 @@ export class DashboardContainer extends Container<InheritedChildInput, Dashboard
}
this.domNode = dom;

this.domNode.className = 'dashboardContainer';

const { Wrapper: DashboardReduxWrapper } = this.reduxEmbeddableTools;
ReactDOM.render(
<I18nProvider>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ export class PanelOptionsMenu extends React.Component<PanelOptionsMenuProps, Sta
? 'embeddablePanelContextMenuOpen'
: 'embeddablePanelContextMenuClosed'
}
repositionOnScroll
>
<EuiContextMenu
initialPanelId="mainMenu"
Expand Down
Loading