Skip to content

[Dashboard] Focus on a single panel#165417

Merged
kertal merged 21 commits intoelastic:mainfrom
cqliu1:dashboard/focus-panel
Sep 25, 2023
Merged

[Dashboard] Focus on a single panel#165417
kertal merged 21 commits intoelastic:mainfrom
cqliu1:dashboard/focus-panel

Conversation

@cqliu1
Copy link
Copy Markdown
Contributor

@cqliu1 cqliu1 commented Aug 31, 2023

Summary

Closes #163274.

This adds support for focusing a single panel on a dashboard while blurring/disabling all other panels.

Aug-31-2023.15-25-11.mp4

All interactions on blurred panels are disabled as well as any layout changes on either the focused or blurred panels, but the user still has access to controls, the editor toolbar, and unified search.

Note: For testing purposes, I have the focus behavior implemented with the Panel settings action, but I won't merge this PR with focus enabled for Panel settings. This behavior is meant for flyouts with inline editing capabilities, like the future ESQL inline editor flyout where changes apply in real-time without hitting Apply to see the changes.

Checklist

Delete any items that are not applicable to this PR.

Risk Matrix

Delete this section if it is not applicable to this PR.

Before closing this PR, invite QA, stakeholders, and other developers to identify risks that should be tested prior to the change/feature release.

When forming the risk matrix, consider some of the following examples and how they may potentially impact the change:

Risk Probability Severity Mitigation/Notes
Multiple Spaces—unexpected behavior in non-default Kibana Space. Low High Integration tests will verify that all features are still supported in non-default Kibana Space and when user switches between spaces.
Multiple nodes—Elasticsearch polling might have race conditions when multiple Kibana nodes are polling for the same tasks. High Low Tasks are idempotent, so executing them multiple times will not result in logical error, but will degrade performance. To test for this case we add plenty of unit tests around this logic and document manual testing procedure.
Code should gracefully handle cases when feature X or plugin Y are disabled. Medium High Unit tests will verify that any feature flag or plugin combination still results in our service operational.
See more potential risk examples

For maintainers

@cqliu1 cqliu1 added Feature:Dashboard Dashboard related features Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas t// loe:small Small Level of Effort impact:high Addressing this issue will have a high level of impact on the quality/strength of our product. ci:cloud-deploy Create or update a Cloud deployment labels Aug 31, 2023
@cqliu1
Copy link
Copy Markdown
Contributor Author

cqliu1 commented Aug 31, 2023

Do we want to disable controls, editor toolbar, and/or unified search access when focused on a single panel as well?
@teresaalvarezsoler @andreadelrio @stratoula

@teresaalvarezsoler
Copy link
Copy Markdown
Contributor

Do we want to disable controls, editor toolbar, and/or unified search access when focused on a single panel as well?

When editing the panel settings it doesn't make much sense to filter visualizations but they don't hurt either so I would leave them accessible for now. In the future, we can reopen the discussion when users are able to edit panel-level filters from there.

Accessing the filters, controls, etc. definetely makes more sense when users are editing a visualization, @stratoula is it fine for ESQL visualizations? I think this doesn't work in Discover now.

@stratoula
Copy link
Copy Markdown
Contributor

stratoula commented Sep 1, 2023

@teresaalvarezsoler not sure I have understood the question correctly but I will give it a shot. We have disabled the kql bar and the filter builder in Discover as you can do all these things with ES|QL. On a dashboard, where we don't have the ES|QL editor we have left the kql bar/filter builder which work fine with dataview and ESQL charts. With that being said, it makes sense to me to not disable these elements when inline editing a visualization.

@teresaalvarezsoler
Copy link
Copy Markdown
Contributor

Great, then let's leave them accessible @cqliu1

@cqliu1
Copy link
Copy Markdown
Contributor Author

cqliu1 commented Sep 8, 2023

RE: a11y, it looks like even though mouse events are disabled for the blurred panels, you can still tab over to the buttons in the blurred panels before reaching the flyout. Do we want to prevent keyboard navigation to the blurred panels? If so, is this a blocker, or can we improve a11y in a follow up PR?

@teresaalvarezsoler @andreadelrio

@cqliu1 cqliu1 marked this pull request as ready for review September 8, 2023 20:39
@cqliu1 cqliu1 requested review from a team as code owners September 8, 2023 20:39
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/kibana-presentation (Team:Presentation)

@cqliu1 cqliu1 requested review from a team as code owners September 8, 2023 20:41
@cqliu1 cqliu1 requested review from a team as code owners September 8, 2023 20:41
@cqliu1 cqliu1 requested a review from a team September 8, 2023 20:41
@cqliu1 cqliu1 requested review from a team as code owners September 8, 2023 20:41
@cqliu1
Copy link
Copy Markdown
Contributor Author

cqliu1 commented Sep 20, 2023

@cqliu1, @teresaalvarezsoler, @stratoula: Per the designs, our suggestion was to leave the unified search interface enabled/accessible, but to disable the editor toolbar when a single panel is focused. Regarding custom controls, I don't think we made a decision regarding whether to enable/disable, so I'll leave that decision up to ya'll (I can see arguments for on both sides).

I've disabled the editor toolbar while a panel is focused, but I'll leave controls accessible.

Screenshot 2023-09-20 at 8 00 33 AM

@ThomThomson
Copy link
Copy Markdown
Contributor

I made some small changes to the debounce effect on width changes:

  1. I changed it from 250 ms to 100ms,
  2. I skip the debounce entirely when the Dashboard has an overlay open.

This results in a smoother open / close experience.

skip debounce

@cqliu1
Copy link
Copy Markdown
Contributor Author

cqliu1 commented Sep 20, 2023

Looking good! The interactions of this (opening/closing the push flyout, rearrangement of the dashboard layout) feel a bit slow and not smooth to me. I wonder if there's a way to optimize this?

@andreadelrio With Devon's changes mentioned above that remove the debounce from overlays, opening and closing the flyout looks much smoother.

@cqliu1
Copy link
Copy Markdown
Contributor Author

cqliu1 commented Sep 20, 2023

In 3f02e1a, I figured out a way to programmatically remove blurred panels and nested elements from the tab order to disable keyboard navigation.

Sep-20-2023.11-29-16.mp4

@cqliu1
Copy link
Copy Markdown
Contributor Author

cqliu1 commented Sep 20, 2023

@elastic/appex-sharedux I'm not sure why you weren't automatically listed as a reviewer, but I enabled the isDisabled prop in the toolbar button so I could disable the editor toolbar when the ESQL flyout is open.

Copy link
Copy Markdown
Contributor

@ThomThomson ThomThomson left a comment

Choose a reason for hiding this comment

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

Changes LGTM! Tested this in chrome, and everything looks good (especially the tab ordering). Also looked through the changes, and left one nit.

Additionally, can you think of a good way to test this, preferably with unit tests? Maybe checking for the presence of a class or a data test subj when focus panel is defined?

isDisabled?: boolean;
}

export const ControlsToolbarButton: FC<Props> = ({ controlGroup, isDisabled }) => {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: why the use of FC here? Using FC like this implicitly adds the children prop, and this toolbar button doesn't actually take children. It's also a little cleaner to just declare the Props type inline instead of naming it.

// https://github.com/react-grid-layout/react-grid-layout/issues/1241#issuecomment-658306889
children,
className,
style,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What was style used for? Nothing?

Copy link
Copy Markdown
Contributor

@sebelga sebelga left a comment

Choose a reason for hiding this comment

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

Shared ux changes LGTM 👍


return (
<div
style={{ ...style, zIndex: focusedPanelId === id ? 2 : 'auto' }}
Copy link
Copy Markdown
Contributor Author

@cqliu1 cqliu1 Sep 20, 2023

Choose a reason for hiding this comment

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

@ThomThomson Before style was destructured from props to override z-index on focusedPanelId which wasn't being used, and it doesn't seem necessary to change the z-index, so I removed the z-index style and removed the style previously destructured on line 46.

If style is passed in as a prop to this component, it will still be spread onto this div with the rest of the props.

Copy link
Copy Markdown
Contributor

@andreadelrio andreadelrio left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for the updates. Nice job on this!

@gchaps
Copy link
Copy Markdown
Contributor

gchaps commented Sep 21, 2023

Can the menu item start with a verb, for example "Apply settings", so that it follows the format of the other items in the menu?

@cqliu1
Copy link
Copy Markdown
Contributor Author

cqliu1 commented Sep 25, 2023

Can the menu item start with a verb, for example "Apply settings", so that it follows the format of the other items in the menu?

@gchaps I'm not sure Apply settings feels right as the label here. That label sounds like it belongs a confirm/submit button on a form to apply changes that the user has made. Can we go with something like Adjust settings or Change settings? Is it okay to omit the word "panel" here? Maybe even Customize panel would sound better.

We renamed from Edit panel settings to Panel settings to avoid confusion between clicking Edit settings, which opens the panel settings flyout for editing the title, description, tags, and custom time range, and clicking Edit visualization/Lens/etc which redirects you to the associated editor.

@gchaps
Copy link
Copy Markdown
Contributor

gchaps commented Sep 25, 2023

After talking with @cqliu1, we decided on Change panel settings.

@ThomThomson
Copy link
Copy Markdown
Contributor

ThomThomson commented Sep 25, 2023

we decided on Change panel settings.

@gchaps @cqliu1 this item also exists in view mode, and in view mode you can't really change the settings. If we must have a verb, maybe we should switch it depending on the view mode?

@cqliu1
Copy link
Copy Markdown
Contributor Author

cqliu1 commented Sep 25, 2023

Yeah in edit mode you can change title, description, tags, along with the time range, but in view mode, you can only edit time range.

Edit mode

Screenshot 2023-09-25 at 12 24 23 PM

View mode

Screenshot 2023-09-25 at 12 24 04 PM

Let's just leave it as Panel settings.

@kibana-ci
Copy link
Copy Markdown

kibana-ci commented Sep 25, 2023

💚 Build Succeeded

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
canvas 1011.7KB 1011.8KB +57.0B
dashboard 355.5KB 356.5KB +992.0B
discover 557.9KB 558.0KB +31.0B
embeddable 12.0KB 12.0KB -45.0B
lens 1.3MB 1.3MB -7.0B
total +1.0KB

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
dashboard 33.9KB 34.3KB +416.0B

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:skip This PR does not require backporting ci:cloud-deploy Create or update a Cloud deployment Feature:Dashboard Dashboard related features Feature:Embedding Embedding content via iFrame impact:high Addressing this issue will have a high level of impact on the quality/strength of our product. loe:small Small Level of Effort release_note:enhancement Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas t// v8.11.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Dashboard] Focus active panel and blur the others