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] Fix switching with layers #71982

Merged

Conversation

wylieconlon
Copy link
Contributor

@wylieconlon wylieconlon commented Jul 15, 2020

There were two issues with the chart switcher that caused it to remove all layers when using these steps:

  1. Create any XY type of chart (i.e. Bar)
  2. Add a second layer
  3. Try switching to a different type of XY chart (i.e. Line)

There were two areas in the code that needed to be fixed:

  1. The XY charts are no longer generating "mixed chart type" suggestions, which was previously possible for multiple layers. The chart switcher was filtering out these mixed chart types.
  2. The chart switcher was showing error indicators for all multi-layer suggestions, which was too frequent. The new behavior only shows a warning when the layers are changing.

The new code also includes a functional test and unit test for the chart switching behavior with multiple layers.

Passes 42 times in flaky test runner: https://kibana-ci.elastic.co/job/kibana+flaky-test-suite-runner/593/

Fixes #71372

@@ -222,7 +222,7 @@ export function InnerWorkspacePanel({
/>
</EuiLink>
</small>
</p>
</div>
Copy link
Contributor Author

@wylieconlon wylieconlon Jul 15, 2020

Choose a reason for hiding this comment

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

This <p> wrapping a <div> was causing errors in tests.

Before:

Screenshot 2020-07-16 13 04 37

After:

Screenshot 2020-07-15 17 09 25

Copy link
Contributor

Choose a reason for hiding this comment

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

😕 ? What does this fix? Using paragraphs is better DOM rendering for screen readers.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It fixes this warning:

console.error
      Warning: validateDOMNesting(...): <div> cannot appear as a descendant of <p>.
          in div (created by EuiIcon)
          in EuiIcon (created by Context.Consumer)
          in EuiI18n (created by EuiLink)
          in a (created by EuiLink)
          in EuiLink (created by InnerWorkspacePanel)
          in small (created by InnerWorkspacePanel)
          in p (created by InnerWorkspacePanel)

Copy link
Contributor

Choose a reason for hiding this comment

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

Those all stem from EuiIcon and it'll be hard to get rid of them until we change the element that EuiIcon renders. I'd rather keep the appropriate text elements for screen-readers when possible and I'll make an issue for this in EUI.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok this is weird, EuiIcon does not in fact ever render a <div> (I think it did way back when, but now it's just a simple <svg>). So this error message is actually completely false. Do we know who setup this DOM validator so I can follow up?

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok, so I think I've tracked this down to the fact that in Kibana, because EuiIcon is dynamically imported, jest tests mock the component into rendering a <div>. So the React warning is actually remarking on the snapshots and not the actual dom. I'll see if the mocks are also coming from EUI, and if so, just get them to render a span.

But in the meantime, can you revert this p to div change? If you truly like the minimized space between the two lines, then wrap them all in a single <p> with a <br /> in between.

@wylieconlon wylieconlon added release_note:fix Team:Visualizations Visualization editors, elastic-charts and infrastructure v7.10.0 v7.9.0 v8.0.0 labels Jul 16, 2020
@wylieconlon wylieconlon marked this pull request as ready for review July 16, 2020 16:04
@wylieconlon wylieconlon requested a review from a team July 16, 2020 16:04
@elasticmachine
Copy link
Contributor

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

Copy link
Contributor

@cchaos cchaos left a comment

Choose a reason for hiding this comment

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

Awesome, thank you for fixing this. I tried out a couple scenarios and switching between the different x/y charts no matter how many layers seems to work fine.

@@ -222,7 +222,7 @@ export function InnerWorkspacePanel({
/>
</EuiLink>
</small>
</p>
</div>
Copy link
Contributor

Choose a reason for hiding this comment

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

😕 ? What does this fix? Using paragraphs is better DOM rendering for screen readers.

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.

Tested in Firefox and works as expected, LGTM 👍

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Build metrics

page load bundle size

id value diff baseline
lens 833.2KB +314.0B 832.9KB

History

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

@wylieconlon wylieconlon merged commit 35ff37a into elastic:master Jul 17, 2020
@wylieconlon wylieconlon deleted the lens/fix-switching-with-layers branch July 17, 2020 18:02
wylieconlon pushed a commit to wylieconlon/kibana that referenced this pull request Jul 17, 2020
* [Lens] Fix chart switching with multiple layers

* Unskip Lens smokescreen test

* Fix types

* Revert <p> change
wylieconlon pushed a commit to wylieconlon/kibana that referenced this pull request Jul 17, 2020
* [Lens] Fix chart switching with multiple layers

* Unskip Lens smokescreen test

* Fix types

* Revert <p> change
wylieconlon pushed a commit that referenced this pull request Jul 17, 2020
* [Lens] Fix chart switching with multiple layers

* Unskip Lens smokescreen test

* Fix types

* Revert <p> change
wylieconlon pushed a commit that referenced this pull request Jul 17, 2020
* [Lens] Fix chart switching with multiple layers

* Unskip Lens smokescreen test

* Fix types

* Revert <p> change
gmmorris added a commit to gmmorris/kibana that referenced this pull request Jul 20, 2020
* master:
  [Observability] Remove app logos (elastic#72259)
  Fix float percentiles line chart (elastic#71902)
  update chromedriver to 84 (elastic#72228)
  [esArchiver] actually re-delete the .kibana index if we lose recreate race (elastic#72354)
  [Maps] convert SavedGisMap to TS (elastic#72286)
  [DOCS] Removes occurrences of X-Pack Security and Reporting (elastic#72302)
  use WORKSPACE env var for stack_functional_integration tests, fix navigate path (elastic#71908)
  [Monitoring] Fix issue with ES node detail status (elastic#72298)
  [SIEM] Updates consumer in export_rule archive (elastic#72324)
  [kbn/dev-utils] add RunWithCommands utility (elastic#72311)
  [Security Solution][Endpoint][Exceptions] Only write manifest to policy when there are changes (elastic#72000)
  skip flaky suite (elastic#72339)
  [ML] Fix annotations pagination & change labels from letters to numbers (elastic#72204)
  [Lens] Fix switching with layers (elastic#71982)
  [Maps] 7.9 documenation updates (elastic#71893)
  docs: ✏️ add "Explore underlying data" user docs (elastic#70807)
  [Security Solution][Exceptions] - Remove initial add exception item button in builder (elastic#72215)
  Fix indentation level in code exploration doc (elastic#72274)
  register graph usage (elastic#72041)
  [Monitoring] Added a case for Alerting if security/ssl is disabled (elastic#71846)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Lens release_note:fix Team:Visualizations Visualization editors, elastic-charts and infrastructure v7.9.0 v7.10.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Lens] All layers are cleared when switching from multi-layer XY chart to any other XY chart
5 participants