“But did they have any right to do that?”
Not if sheriff is designated as an elective office in the California constitution.
Well, if it a designated elective office in the CA constitution, then arresting her sets the stage to challenge the law, since she has now been materially harmed by it.