After decades of pandering to intolerance while working against the needs of working-class Americans and minorities, the Republican Party appears headed for disaster. As its post-mortem report said, it didn’t have to be this way.

The question now is, what will the candidates beaten by Mr. Trump, like Mr. Rubio, do? Will they endorse the man they portrayed as a threat to the nation, or take a more principled stand? What are party leaders like Reince Priebus, the Republican National Committee chairman, prepared to do?

For Democrats, the remainder of the primary season will be less perilous. While Hillary Clinton continues her march toward the nomination, the weakness of her appeal among the young, independents, men and some working-class voters cannot be ignored. Though she and her campaign insist they have always envisioned a long, tough battle with Bernie Sanders, they have been challenged in ways they could not have expected. And Mr. Sanders has the drive, the money and the delegates to stay in the race until the end. No matter what happens, he will help determine the party’s future priorities.

Mr. Sanders’s quixotic candidacy has not offered concrete ways to achieve his goals with a Republican-controlled Congress, and he hasn’t been able to win over enough African-American and Latino voters. But he has managed to take aim at Mrs. Clinton’s vulnerabilities — like her paid speeches to Wall Street firms and her shifts in position on issues like gay marriage, trade agreements and immigration — to some effect. Some voters accuse her of saying whatever it takes to win, and as she tacks to the left in response to Mr. Sanders’s challenge, that perception may increase.

Still, Mrs. Clinton’s strong performance Tuesday puts her even further out of Mr. Sanders’s reach. But she has to do more than defeat him for the nomination. Mr. Sanders’s success has been as the voice of Democrats resentful of a party establishment that has been too tepid in taking on issues like income inequality. She will have to somehow connect with his supporters and show them she understands them, particularly since some of them are potential Republican voters come November.