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

feat(tooltip): anchored/fixed position #1122

Merged

Conversation

markov00
Copy link
Member

@markov00 markov00 commented Apr 15, 2021

Summary

Adding the prop stickTo to the tooltip settings to specify where to stick the tooltip respective to the cursor.

Apr-15-2021.17-26-32.mp4

fix #921

Checklist

Delete any items that are not applicable to this PR.

  • Any consumer-facing exports were added to src/index.ts (and stories only import from ../src except for test data & storybook)
  • Proper documentation or storybook story was added for features that require explanation or tutorials
  • Unit tests were updated or added to match the most common scenarios

@markov00 markov00 force-pushed the 2021_04_15-tooltip_fixd_on_top/bottom branch from d391b43 to be1a8b1 Compare April 21, 2021 14:34
@codecov-commenter
Copy link

Codecov Report

Merging #1122 (be1a8b1) into master (c1b59f2) will decrease coverage by 0.01%.
The diff coverage is 25.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1122      +/-   ##
==========================================
- Coverage   72.26%   72.25%   -0.02%     
==========================================
  Files         387      404      +17     
  Lines       12021    11582     -439     
  Branches     2629     2363     -266     
==========================================
- Hits         8687     8368     -319     
+ Misses       3309     3091     -218     
- Partials       25      123      +98     
Flag Coverage Δ
unittests ?

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/components/portal/types.ts 100.00% <ø> (ø)
src/specs/settings.tsx 90.00% <ø> (-0.33%) ⬇️
.../chart_types/xy_chart/crosshair/crosshair_utils.ts 74.07% <16.66%> (+0.58%) ⬆️
...s/xy_chart/state/selectors/get_tooltip_position.ts 72.22% <50.00%> (-2.78%) ⬇️
src/state/selectors/get_legend_items_labels.ts 50.00% <0.00%> (-50.00%) ⬇️
src/utils/dimensions.ts 71.42% <0.00%> (-28.58%) ⬇️
src/components/no_results.tsx 50.00% <0.00%> (-25.00%) ⬇️
src/chart_types/xy_chart/utils/panel_utils.ts 72.72% <0.00%> (-19.59%) ⬇️
src/components/error_boundary/errors.ts 50.00% <0.00%> (-16.67%) ⬇️
src/chart_types/xy_chart/rendering/point_style.ts 87.50% <0.00%> (-12.50%) ⬇️
... and 222 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c1b59f2...be1a8b1. Read the comment docs.

@markov00 markov00 marked this pull request as ready for review April 22, 2021 10:48
Copy link
Collaborator

@nickofthyme nickofthyme left a comment

Choose a reason for hiding this comment

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

LGTM. Tested locally and works great.

One thing that may be confusing is that the offset is relative to the placement and not stickTo. So if stickTo = 'top' and placement = 'rightStart' with offset = 50 you get this...

Screen Recording 2021-04-22 at 04 53 12 PM

Where there is no offset from the top. I think this is the correct way of doing it but people might get confused.

stories/area/2_with_time.tsx Outdated Show resolved Hide resolved
src/components/portal/types.ts Show resolved Hide resolved
@markov00
Copy link
Member Author

One thing that may be confusing is that the offset is relative to the placement and not stickTo. So if stickTo = 'top' and placement = 'rightStart' with offset = 50 you get this...

@nickofthyme you are right, probably we should prefix the offset prop with something like placementOffset to be more clear

@markov00 markov00 merged commit 12417e2 into elastic:master Apr 23, 2021
nickofthyme pushed a commit that referenced this pull request Apr 23, 2021
# [29.1.0](v29.0.0...v29.1.0) (2021-04-23)

### Bug Fixes

* **interaction:** remove unnecessary elements ([#1131](#1131)) ([411042f](411042f)), closes [#1074](#1074)
* **partition:**  fix safari highlight bug on single slice ([#1132](#1132)) ([4a04063](4a04063)), closes [#1085](#1085)

### Features

* **tooltip:** add stickTo option ([#1122](#1122)) ([12417e2](12417e2)), closes [#921](#921)
@nickofthyme
Copy link
Collaborator

🎉 This PR is included in version 29.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@nickofthyme nickofthyme added the released Issue released publicly label Apr 23, 2021
AMoo-Miki pushed a commit to AMoo-Miki/OpenSearch-Dashboards that referenced this pull request Feb 10, 2022
@markov00 markov00 deleted the 2021_04_15-tooltip_fixd_on_top/bottom branch April 11, 2022 10:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
released Issue released publicly
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tooltip: fixed position instead of following mouse and improved line indicator
3 participants