How to get plotly legend item name and visible property when clicked on legend item

Hi Team,

I want legend name and visible value when clicked on the legend item. I tried with legend_click event but getting the previous saved value of the legend item visible property. Can you guys help me out