There are real risks for Republicans. Seating a man on the nation’s highest court who was accused in searing terms of sexual misconduct has only enraged many women who were already eager to register their contempt for Mr. Trump at the polls. And it may further imperil the party’s tenuous House majority and its prospects in a handful of big-state governor’s races that could turn on anti-Trump energy.

But the terms of the debate have shifted profoundly for Democratic Senate candidates.

From North Dakota and Missouri to Montana and Tennessee, they have been trying to localize races, either ignoring Mr. Trump or highlighting their willingness to work with him while playing down the court fight and emphasizing regional issues.

In Montana, Senator Jon Tester and his allies have been assailing his Republican opponent, Matt Rosendale, a Maryland native, as an East Coast real estate developer. In Missouri, Senator Claire McCaskill has taken every chance to highlight the Ivy League and law professor background of her challenger, Josh Hawley.

At the same time, Phil Bredesen, the Democratic Senate nominee in Tennessee, has done just about everything he can to distance himself from national Democrats. He has spent much of his campaign talking about his tenure as governor and as Nashville’s mayor, and even tried to inject the invasion of Asian carp in the state’s waterways as an issue in the race.

And Ms. Heitkamp has portrayed herself as a champion of North Dakota’s farmers and ranchers, recording ads of herself standing in knee-high soybean fields.

Now, though, Republicans in these races are using the court clash to turn the campaign into more of a national referendum on the fate of their 51-49 majority and a test of which side the voters are on: that of Mr. Trump and Justice Kavanaugh or the angry Democratic opposition.