The one attached to my toilet has this setup to keep it from getting dirty: there’s a plastic barrier in front of the nozzle, which has a mechanism that causes it to pop out from underneath the barrier when water is flowing through it, and retract back behind the barrier when the water is shut off.