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

[Lens] (Accessibility) Added button to execute drag and drop to workspace #85960

Merged
merged 17 commits into from
Jan 20, 2021

Conversation

mbondyra
Copy link
Contributor

@mbondyra mbondyra commented Dec 15, 2020

Summary

Fixes #83730
Fixes #83600

Description of functionality here.

Checklist

Delete any items that are not applicable to this PR.

For maintainers

@mbondyra mbondyra added Project:Accessibility Team:Visualizations Visualization editors, elastic-charts and infrastructure v8.0.0 release_note:skip Skip the PR/issue when compiling release notes Feature:Lens v7.11.0 labels Dec 15, 2020
@MichaelMarcialis
Copy link
Contributor

MichaelMarcialis commented Dec 17, 2020

Hey, @mbondyra! Per your request, I've made a quick design PR for your branch. Have a look here whenever you get a moment:

mbondyra#4

…_workspace_design

[Lens] "Add field to workspace" button design tweaks
@mbondyra
Copy link
Contributor Author

@elasticmachine merge upstream

@LeeDr
Copy link
Contributor

LeeDr commented Jan 7, 2021

Since we're past 7.11.0 FF, and this isn't a bug fix, should probably bump to 7.12.0.

@mbondyra mbondyra added v7.12.0 and removed v7.11.0 labels Jan 11, 2021
@mbondyra
Copy link
Contributor Author

@elasticmachine merge upstream

@flash1293
Copy link
Contributor

@elasticmachine merge upstream

@flash1293
Copy link
Contributor

@mbondyra I fixed types and tests (and restructured the code a little), could you check whether everything is still working as intended from your side?

Copy link
Contributor

@wylieconlon wylieconlon left a comment

Choose a reason for hiding this comment

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

I tested this behavior and found that it worked consistently with what we have on master, so that part LGTM. The organization of this code makes sense too by moving this to the frame level. The only comment I have is that you've taken tests out without adding equivalent tests, and I'd like to make sure we keep those.

field,
mainPalette,
});
return suggestions.find((s) => s.visualizationId === activeVisualizationId) || suggestions[0];
Copy link
Contributor

Choose a reason for hiding this comment

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

I tried to break the suggestion logic here, and it does seem to be working consistently with what we have on master, but might benefit from some extra tests. It seems like we are intentionally switching the subVisualizationId on some chart types, like between donut -> pie when you add a second agg. Is this tested?

}}
title={buttonTitle}
/>
</EuiFlexItem>
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 I would have appreciated an EuiTooltip here instead of a title property- it seems like this button is potentially confusing for mouse users.

@mbondyra
Copy link
Contributor Author

The behavior looks good to me, couldn't find any edgecases. I agree with Wylie's comment about tests tooltip. And just like we discussed, about adding disabled button to not have this state:
image

@flash1293
Copy link
Contributor

Thanks for the review @wylieconlon - I think the tests are all covered now, although structured differently:
I removed the following:

  • should refuse to drop if there only suggestions from other visualizations if there are data tables - this is covered by should not consider suggestion from other visualization if there is data
  • should allow to drop if there are suggestions from active visualization even if there are data tables - covered by should return top suggestion for field
  • should immediately transition to the first suggestion if there are multiple - also tested by should immediately transition to the first suggestion if there are multiple (because mockVisualization1 returns two suggestions)

About

I tried to break the suggestion logic here, and it does seem to be working consistently with what we have on master, but might benefit from some extra tests. It seems like we are intentionally switching the subVisualizationId on some chart types, like between donut -> pie when you add a second agg. Is this tested?

We are picking the top suggestion of the current data source as tested in the new suggestion_helpers tests - at that point we don't check the sub visualization id at all because that's an implementation detail of the visualization and transparent for the frame logic under test (the visualization itself is mocked out). Am I missing something?

I also added tooltips and keep the button in a disabled state if it can't be used right now:
Screenshot 2021-01-15 at 10 27 58
Screenshot 2021-01-15 at 10 28 05

@mbondyra mbondyra marked this pull request as ready for review January 15, 2021 16:58
@mbondyra mbondyra requested a review from a team January 15, 2021 16:58
@mbondyra mbondyra requested a review from a team as a code owner January 15, 2021 16:58
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-accessibility (Project:Accessibility)

@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-app (Team:KibanaApp)

@flash1293
Copy link
Contributor

@elasticmachine merge upstream

Copy link
Contributor

@flash1293 flash1293 left a comment

Choose a reason for hiding this comment

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

LGTM as I wrote parts of it, waiting for design review

@flash1293
Copy link
Contributor

As discussed with @mbondyra the popover is closed now on adding it to the workspace to make it possible to see all of the resulting chart and to circumvent a focus bug in firefox

@mbondyra
Copy link
Contributor Author

Checked again - the bug is fixed, approved!

Copy link
Contributor

@myasonik myasonik left a comment

Choose a reason for hiding this comment

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

Two nits but works well! 🚀

onClick={() => {
dropOntoWorkspace(field);
}}
title={buttonTitle}
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: With EuiToolTip already in place here, I think we can get rid of this

Copy link
Contributor

@MichaelMarcialis MichaelMarcialis left a comment

Choose a reason for hiding this comment

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

LGTM as I wrote parts of it, waiting for design review

@flash1293: A design PR from me with my suggested changes was merged into this branch earlier. This still looks good to me, with the exception of one new bug that I noticed today.

It seems that the "Add field to workspace" buttons can occasionally (and perhaps randomly) be immediately auto-focused when the field popover is opened. The button focus then causes the button's tooltip to show. It appears to only happen when opening the popover via mouse click on the field. It does not appear to happen when using the keyboard to open the popover. Is this a known issue?

lens-auto-focus-bug

Copy link
Contributor

@wylieconlon wylieconlon 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, although I agree with @myasonik on the small tweaks

@flash1293
Copy link
Contributor

Thanks for the reviews. I addressed Michails remarks and fixed Michaels bug

@kibanamachine
Copy link
Contributor

💚 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
lens 1.1MB 1.1MB +5.4KB

History

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

Copy link
Contributor

@MichaelMarcialis MichaelMarcialis left a comment

Choose a reason for hiding this comment

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

Thanks for fixing that bug, @flash1293. LGTM!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Lens Project:Accessibility release_note:skip Skip the PR/issue when compiling release notes Team:Visualizations Visualization editors, elastic-charts and infrastructure v7.12.0 v8.0.0
Projects
None yet
8 participants