In the event that the person refuses to cooperate, you can call the election center to get confirmation that they're electioneering and—if so—you can simply call the police and have them deal with it if it's egregious enough.
Realistically, the situation you're asking about just doesn't happen often enough to be of concern. Most of the time, people aren't "trying" to electioneer. They're just excited about their candidate, and when told about the law and asked to take down a sign or remove a hat, they'll do so even if begrudgingly. The people who actually want to electioneer aren't shy about it and step way over the line. For anything in the middle, simply make a judgment call and go with it.
They were considered "campaign slogans or political movement slogans".
Source: am an SF election inspector.
That said, it’s all up to the specifics of state law.