giraffe icon indicating copy to clipboard operation
giraffe copied to clipboard

Tooltips should not be visible when cursor is over hidden parts of graph

Open philjb opened this issue 5 years ago • 5 comments

Current Behavior

Graph tooltips will stay visible when part of a graph is hidden due to scrolling. To reproduce, scroll your dashboard so part of a graph is hidden by the top of the headerbar of the dashboard (where the time range selector is). Start your cursor at the visible part of the graph (with tooltips on) and see that the tooltip appears. Without leaving the graph to the left or right, move the cursor up to the header bar and see that the tooltip remains even though you are now off the visible part of the graph (but obviously above the hidden part of the graph).

Reproduced on safari.

tt

Desired Behavior

The tooltip should only show when my cursor is over visible parts of the graph.

philjb avatar Sep 29 '20 20:09 philjb

cc @TCL735

philjb avatar Sep 29 '20 20:09 philjb

Interestingly, this never happens with a vertical orientation tooltip. I made a video of this comparison:

https://user-images.githubusercontent.com/10736577/136482802-80845c73-e23b-443f-9542-d615edde08ae.mp4

TCL735 avatar Oct 08 '21 01:10 TCL735

After studying the behavior closely, the reason this issue happens is because the tooltip is overlapping the mouse cursor. Notice that in the previous comment's video that a vertical orientation tooltip prevents this from happening. The reason is because the tooltip is smaller and never overlaps with the cursor.

Here is another video to show that tooltip orientation by itself is not the reason, but the overlapping is the reason.

https://user-images.githubusercontent.com/10736577/136482822-27ad7963-43fb-4835-8af5-19d431611143.mp4

TCL735 avatar Oct 08 '21 01:10 TCL735

So, I think the fix here will involving calculating just how large a tooltip would be based on data and cross-check that size with the position of it and the cursor in the viewport, and if there is overlap then we should nudge the tooltip in one direction until it doesn't overlap the cursor. That way, once the cursor leaves the visible part of the graph, the tooltip will disappear as intended.

This is extremely complex and very calculation intensive, potentially very bad for performance.

TCL735 avatar Oct 08 '21 01:10 TCL735

Since we already have a way for the user to adjust the size of the tooltip, which is one way to avoid this problem, I am taking the bug label off and calling this a feature. Also, moving this to the Giraffe repository.

TCL735 avatar Oct 08 '21 01:10 TCL735