plotly / react-plotly.js

A plotly.js React component from Plotly 📈
MIT License
1.01k stars 135 forks source link

Clickmode "event+select" activated and Clicking outside of Graph calls onUpdate incorrectly #341

Open willhuang1997 opened 4 months ago

willhuang1997 commented 4 months ago

Hi, currently working on Streamlit + Plotly selections! I noticed this bug that didn't seem like a bug on Streamlit's side.

It seems like onUpdate gets called and graph gets updated visually incorrectly when clickmode: "event+select" and dragmode: "select" and doing selection clicks. I would expect onDeselect to be called and layout.selections to remove the selection because selectedpoints in data has []

Reproducible example: https://codesandbox.io/p/sandbox/react-forked-6rypkr?file=%2Fsrc%2FApp.tsx

Steps to reproduce:

  1. Click on a single point
  2. Click outside of a point

Expectation: Graph is not less than 100% opaque Actual: Graph is less than 100% opaque and weird and onUpdate is not called

Video to show actual:

https://github.com/plotly/react-plotly.js/assets/16749069/632b9ef7-c213-4a27-a7c7-08f5b8c9417e

I read that most issues here are likely Plotly.js problems but not sure if that's the case because I went to check plotly.js code and onUpdate is a callback while plotly.js contains an update function as far as I can tell.