-
Notifications
You must be signed in to change notification settings - Fork 122
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): pinned tooltip with actions #1782
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work! It's a WIP so all these below may be on your list already:
There are some statefulness issues, for example:
- activating the tooltip, then, as the next step, trying to activate it elsewhere just clears the pinned tooltip
- even after clearing (right-click on another bar) it's not possible to pin the tooltip, it requires that the mouse first be moved, probably to populate x/y values (right-click DOM interactions also pass on coordinates, so I think there should be no requirement for a mousemove)
- activating the tooltip, then left-clicking on another bar (or pretty much anything else, except, apparently, the Esc key or another right-click tooltip activation attempt) doesn't clear the pinned tooltip
It'd feel odd to maintain the pinned status if the user clicks (eg. left-clicks) elsewhere. A click is a strong expression of intent, whether activating something else or cancelling a current modality. Our interaction design for this should be such that it's super easy to get out of the pinned mode. So, starting with "literally everything gets the user out of pinned mode" then remove hover from that list (I think only a subsequent hover should leave the tooltip pinned)
Wondering if the pinned tooltip needs the common ☒ button on the top of the tooltip as another means for cancellation. While also observing Fitts law (ie. the unpin hotspot can/should be larger than the visible ☒ or pin symbol)
(Maybe it's done already) It'd also be great to link to an interaction design document. The current way doesn't just pin the tooltip, it in effect establishes a strong, new modality that overrides everything. Worth comparing it to the more fleeting persistence of such tooltips in Tableau. In any case, it's worth making interaction design choices explicit, and supported with comparisons and arguments
Minor: I'd also rename the PR, because it's more of a pinned thing than a sticky one, and whether the "tooltip" has actions or not is secondary, so I'd just call it "pinned tooltip" or similar. "Sticky" also has the issue that its past participle is "stuck" and that has other connotations (unwanted behavior, like a stuck button)
Agree with Robert, this only partially is related to the tooltip, this is more a contextual menu than a sticky/pinned tooltip. For the interaction/cancellation/clearing it should behave exactly as a right-click context menu in the browser: if you click elsewhere or in one item of the menu, the menu will disappear immediately |
- configurable max height on tooltip body - configurable tooltip action prompts from spec - add disabled option for action config - cleanup action styles
- clear active position only after action taken - block pinning on axis tooltip - improve pinning logic for heatmap edge cases
buildkite update vrt |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything looks good expect for the fact that the control+click
on mac doesn't works as expected. It initially pins the tooltip but a subsequent mouse movement will unpin the tooltip.
control+click
should follow the same behaviour of the secondary click
on mac (usually the two finger click)
Good catch, fixed in 0367fed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything looks good to me, amazing work Nick!
BREAKING CHANGE: tooltip actions, interaction behavior and styles Co-authored-by: Marco Vettorello <vettorello.marco@gmail.com> Co-authored-by: elastic-datavis[bot] <98618603+elastic-datavis[bot]@users.noreply.github.com>
# [51.0.0](v50.2.0...v51.0.0) (2022-11-08) ### Features * **tooltip:** pinned tooltip with actions ([#1782](#1782)) ([7a054f7](7a054f7)) ### BREAKING CHANGES * **tooltip:** tooltip actions, interaction behavior and styles Co-authored-by: Marco Vettorello <vettorello.marco@gmail.com> Co-authored-by: elastic-datavis[bot] <98618603+elastic-datavis[bot]@users.noreply.github.com>
Summary
Adds sticky tooltip interaction whenever
Tooltip.actions
are defined. See demo story here.Features:
Chart types with context menu:
cartesian charts
story examplepartition charts
- story exampleheatmap
- story exampleflamegraph
- story exampleTODOs (moved to #1859)
Screen.Recording.2022-08-20.at.04.24.33.PM.mp4
Testing in kibana
To test against this PR on kibana update the
package.json
to point to thetooltip-actions-dist
branch.Then run bootstrap with
--no-validate
flag...See kibana example/testing/demo at elastic/kibana#141503
Details
Modifies the
interactions
redux state to add tooltip stuck/selection state and account for the stuck state and disable existing interactions like drag and click while stuck.The esc option to cancel the brush interaction was added a while ago but was a little loose when adding and removing the keyboard event listeners.
Scroll into view demo
Screen.Recording.2022-08-29.at.05.56.53.PM.mp4
This feature works by scrolling to the first highlighted tooltip value. Some improvements on this logic could be...
Issues
fix #1857
Checklist
:xy
,:partition
):interactions
,:axis
):theme
label has been added and the@elastic/eui-design
team has been pinged when there areTheme
API changescloses #123
,fixes #123
)packages/charts/src/index.ts
dark
,light
,eui-dark
&eui-light