Skip to content

Remove Sass @euiToolTip mixin usages#194652

Closed
cee-chen wants to merge 7 commits intoelastic:mainfrom
cee-chen:eui/remove-tooltip-mixin
Closed

Remove Sass @euiToolTip mixin usages#194652
cee-chen wants to merge 7 commits intoelastic:mainfrom
cee-chen:eui/remove-tooltip-mixin

Conversation

@cee-chen
Copy link
Copy Markdown
Contributor

@cee-chen cee-chen commented Oct 2, 2024

Summary

This PR is part of EUI's ongoing Emotion migration, and removes EuiToolTip Sass mixins that will shortly be removed/deprecated from EUI.

3 usages of tooltip style mixins have been replaced with its migrated Emotion/CSS-in-JS equivalent. This is a somewhat stopgap measure - if possible, we'd prefer consumers not reach directly into our internal/styles and use the baseline <EuiToolTip> component instead. That being said, I've QA'd (almost) all instances and have confirmed that the affected tooltips still look the same as before (see below inline comment threads for before/after screenshots).

Checklist

- normally we don't recommend reaching directly into components for styles, but this is the easiest migration path forward currently
@cee-chen cee-chen added release_note:skip Skip the PR/issue when compiling release notes EUI v9.0.0 v8.16.0 backport:version Backport to applied version labels labels Oct 2, 2024
- Emotion styles come with font size/line height set, this unsets it to previous render
- normally we don't recommend reaching directly into components for styles, but this is the easiest migration path forward currently
- normally we don't recommend reaching directly into components for styles, but this is the easiest migration path forward currently
@@ -1,15 +1,12 @@
.detailedTooltip {
pointer-events: none;
@include euiToolTipStyle('s');
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Before After

}

.tooltipAnnotation {
@include euiToolTipStyle($size: 's');
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Before After
canvas before canvas after

@@ -1,19 +1,18 @@
.mlChartTooltip {
@include euiToolTipStyle('s');
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Before After

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

In the screenshot above the tooltip is now hiding the red marker on the chart.

@cee-chen cee-chen marked this pull request as ready for review October 2, 2024 02:08
@cee-chen cee-chen requested review from a team as code owners October 2, 2024 02:08
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/eui-team (EUI)

@@ -1,12 +1,15 @@
.visTooltip,
.visTooltip__sizingClone {
@include euiToolTipStyle('s');
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@elastic/kibana-visualizations I'm not sure where this tooltip is being used or how to reproduce it/see it in the browser - I'm fairly sure this change should work without major issue, but please let me know if not.

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.

Hi @cee-chen you can test it by turning on the visualization:visualize:legacyHeatmapChartsLibrary advanced setting and creating an Agg Based heatmap.

I've tested locally and I believe we need to bring all the properties there, because the color you have assigned are different then before.
Before:
Screenshot 2024-10-02 at 10 08 14
After:
Screenshot 2024-10-02 at 10 03 48

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.

Unfortunately the code there is not React so you can't use the hooks for EUI.
Probably just copying the shadow/border/background/color is enough

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ah I hadn't realized the difference was that stark, I'll copy the shadeOrTint Sass exactly in that case. It's still fairly fragile however as a warning - If EuiToolTip's styles ever change in the future (there is talks of a new theme on the horizon) then you'll need to manually update your custom tooltip to match.

Copy link
Copy Markdown
Contributor

@markov00 markov00 Oct 4, 2024

Choose a reason for hiding this comment

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

I know, but just consider that these tooltip and visualization editor will be remove in the future, so don't worry about that too much.
So please go on with and copy the EUI tooltip styles for now, thanks

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.

@cee-chen I'm just waiting for this to approve, whenever you have it ready please ping me

@kibana-ci
Copy link
Copy Markdown

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] Jest Tests #12 / CaseDetailsLink renders the children instead of the detail name if provided
  • [job] [logs] Jest Tests #12 / ConnectorSelector should set the selected connector to none if the connector is not available

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
canvas 1291 1425 +134
expressionXY 254 388 +134
ml 2040 2174 +134
total +402

Async chunks

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

id before after diff
canvas 1.1MB 1.2MB +178.0KB
expressionXY 127.7KB 305.5KB +177.8KB
ml 4.6MB 4.8MB +178.1KB
visTypeVislib 371.6KB 371.1KB -494.0B
total +533.4KB

Page load bundle

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

id before after diff
expressionXY 41.9KB 42.0KB +111.0B
ml 74.4KB 74.4KB +53.0B
total +164.0B

History

  • 💛 Build #238608 was flaky e90ba3d93b52a7e1f05b51b745820fc33cebd1e3

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

import TooltipTrigger from 'react-popper-tooltip';
import { EuiFlexGroup, EuiFlexItem } from '@elastic/eui';
import { EuiFlexGroup, EuiFlexItem, useEuiMemoizedStyles } from '@elastic/eui';
// @ts-ignore Kibana does not have types for eui/lib
Copy link
Copy Markdown
Member

@jgowdyelastic jgowdyelastic Oct 2, 2024

Choose a reason for hiding this comment

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

Suggested change
// @ts-ignore Kibana does not have types for eui/lib
// @ts-expect-error Kibana does not have types for eui/lib

@ts-expect-error would probably be better here as it'll catch when these types are fixed.

@jgowdyelastic
Copy link
Copy Markdown
Member

jgowdyelastic commented Oct 2, 2024

Tooltip placement in ML seems to be broken with this fix. They now overflow off the side of the screen.
It appears than previously tooltips would appear on the left or right of the cursor depending on whether the cursor is on the left of right of the screen.

Before
image

image

image

After
image

image

image

Copy link
Copy Markdown
Contributor

@nreese nreese left a comment

Choose a reason for hiding this comment

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

kibana-presentation changes LGTM
code review only

@cee-chen
Copy link
Copy Markdown
Contributor Author

Hey y'all! Super apologies for dropping the ball on this PR for a bit. I ended up realizing that EUI unfortunately can't deprecate the @euiToolTip Sass mixin just yet as elastic-charts relies on it to render its tooltips. As such, this PR isn't needed in Kibana, so I'm going to go ahead and close it. I'll investigate another approach EUI can take that could play well with Sass or just vanilla CSS.

@cee-chen cee-chen closed this Oct 14, 2024
@cee-chen cee-chen deleted the eui/remove-tooltip-mixin branch October 14, 2024 20:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:version Backport to applied version labels EUI release_note:skip Skip the PR/issue when compiling release notes v8.16.0 v9.0.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants