Hi! If you haven’t already you could watch Bubble’s tutorial on custom states.

But I think all you need to do here is add a custom state to the icon then, in the same workflow when the popup is closed, add an action for “Set state of an element” to set it to “Password Hidden”. Now your icon should only be visible when the custom state = “Password visible”