How to fix set visibility does not working

Try to use the collapse option. I was having a similar problem, but in my case I couldn’t hide a widget that was inside another widget, and so, I could only collapse it.