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

On_selection callback on sankey diagram

Hi! I am trying to fully personalize the sankey plot (in python) and I got stuck with the on_selection function. When selecting more than 1 node, then these are merged into a single node and the graph is updated. I am trying to override this behavior with sankey_figure.on_selection(new_function) -where “new_function” is defined below- but it doesn’t work.
Do you know a way to disable the default selection event?
Thank you in advance!

def new_function(trace,points,selector):
    with fig.batch_update():
        fig.data[0].node.color[points.point_inds[0]] = 'red'