plotly / plotly/plotly.js

Click events stop firing after slow "double" click (when using beforehover event handler)

未关闭
#6,582 4 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

bug P2
主要语言
JavaScript
星标
18.3k
派生
2k
平均合并
2 天 12 小时
30 天内合并 PR
28

描述

Hello,

I'm using the plotly_click and plotly_beforehover events to get the hover label to persist when someone clicks on a data point.

The idea is that after someone clicks a store a reference to the point they've clicked on. Then in the before hover event, if that reference is populated I cancel the hover event.

(I'm doing more than this in the actual code, but this represents the problem).

If you click quite fast, not fast enough to register as a double click, but pretty quickly, as you move the mouse around. Then sometimes that causes the click events to stop being fired.

This seems to happen when there is a point that should have a persistent hover. The hover gets turned off but then no other hovers are displayed. The reference is populated but the user can't click to turn it off. So you get stuck with no hover labels showing up.

Here's a demo: https://jsfiddle.net/mdt6rqck/

It feels like the quick clicking causes some kind of hover state to get stuck? So now the click events can't get through?

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

使用链接的 JSFiddle 重现 hover 卡住的行为,重点关注速度快但慢于双击的点击,以及 plotly_click 和 plotly_beforehover 处理器。跟踪 hover 和点击事件的入口点,以确定后续点击为何会被抑制;当可以清除持久的 hover 标签且后续点击继续触发时,即表示完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
javascript
领域
data-visualization
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
42/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。