handle visibility also for leaf nodes