Unselect points when click empty area

The solutions above don’t work for me. Here is my solution:

https://jsfiddle.net/8s49c4jo/1/

The trick is setting the traces selectedpoints attribute to null:

Plotly.restyle(graphDiv, {selectedpoints: [null]});