I agree that there's some self-selection and simple demographics involved (as other posters talked about), but I don't think that's the whole story.
For example, take
this article from 2018:
San Francisco Acting Mayor London Breed was removed from the job by her colleagues at the Board of Supervisors in a Tuesday vote that surprised many in the city.
...
The vote to remove her as acting mayor came after hours of public testimony -- much of it very emotional and charged with racial undertones. As soon as it became apparent that the first African-American woman to lead San Francisco was being replaced by a white male representing some of the city's wealthiest neighborhoods, the board chambers erupted.
Some members of the audience, infuriated by the turn of events, chanted, "Shame, shame, shame."
"This is war!" some shouted as board members left the chambers.
...
Farrell's appointment as interim mayor was delivered not by his allies on the Board of Supervisors' moderate faction but by the board's most progressive members, including Supervisors Aaron Peskin and Jane Kim, who is herself running for mayor. Their goal was to remove the political advantage Breed had as acting mayor in the June election -- and they did.
I think this shows one example of how there's a disadvantage to being a white male politician in San Francisco in the current political climate. There are a lot of highly mobilized voters/groups who place a high priority on electing diverse candidates, and who are outraged by anything that they perceive as backsliding.