Can't lock in rotation direction

I found a solution posted by @box here – very clever