Skip to content

Unhover does not fire when drag triggers unhover #5437

Closed
@rreusser

Description

@rreusser

To aid hooking up external behavior on hover/unhover, there is a small inconvenience with plotly_unhover not being fired when dragging triggers unhover.

Version: Plotly 1.58.4
Browser: Chrome 88.0.4324.96 (Official Build) (x86_64)
Platform: Mac OS X 10.13.6

var Plotly = require('plotly.js');
var gd = document.createElement('div');
document.body.appendChild(gd);

Plotly.plot(gd, [{ x: [1, 2, 3], y: [4, 2, 1] }]);

gd.on('plotly_unhover', function () {
    console.log('unhover!');
});

The gif below illustrates the issue. In particular, when dragging to zoom begins, the console.log counter from previous unhovers is at 3. The hover disappears, the zooming completes, but plotly_unhover count remains at 3 until a new hover is created and then unhovered once more.

In other words, the unhover which should result from unhovering when dragging is completely missed, making it more inconvenient to use hover/unhover to interpret what the hover state ought to be.

hoverissue

Notes:

  • I removed hovermode:closest from the js code above, though the gif did have that enabled. I confirmed it has no effect but didn't recreate the gif.
  • Fire unhover when dragging plot #5407 will fix this issue and will be complete once a test is added for this case

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugsomething broken

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions