Black Lives Matter. Please consider donating to Black Girls Code today.

Deselecting points on plotly click event

After selecintg points using lasso/box select if I click on another point the points remain selected. Is there a way to deselect points using a function in plotly.js?
I tried setting[0].selectedpoints to null, however the points still remain selected on the chart.
Here is the codesandbox: that you can see the behaviour.
Try selecting few points using box select and see that they remain selected after.

Hmm. Have you tried calling:

Plotly.restyle(/* id of your graph */, 'selectedpoints', null)