Presiden Trump listens as Attorney General William Barr delivers remarks in the Rose Garden on July 11. (Jabin Botsford/The Washington Post)

The agonizing fact for Democrats this summer is that President Trump appears to be gaining ground on domestic and foreign policy, while his potential challengers are quarreling and mostly spinning their wheels.

Trump is taunting allies and defying Congress — and seemingly getting away with it. He isn’t just rewriting the political rulebook, he’s tossing it aside. And the painful fact is that the Democrats haven’t figured out a way to stop his forward momentum, even when they believe it’s taking the country over a cliff.

Trump remains a divisive and unpopular leader who is vulnerable in 2020. But a Post-ABC News poll released last week was the clearest warning yet for Democrats that Trump is gaining strength beyond his core base of support.

Trump’s approval rating has risen 5 points since April, to 44 percent, according to the survey. His disapproval rating is 53 percent, but his support is still the highest he’s had as president. The RealClearPolitics average of major polls shows a similar trend.

Trump would probably be doing even better if so many people weren’t turned off by his crass behavior. Commentator Steven Rattner recently noted the gap between the 56 percent predicted support for an incumbent with this record, as modeled by Yale economist Ray Fair, and Trump’s much lower actual support in polls.

Trump’s best issue is the economy. Last week’s employment report showed sharp job growth, led by manufacturing. There are caveats: The distribution of rewards is grossly unequal, and growth has been pumped by deficit spending. There are signs of weakness ahead, too, but even the New York Times’ editorial board agrees with Trump that the Federal Reserve should cut interest rates, perhaps extending the recovery.

Trump’s anti-immigrant policies are appalling, but they don’t seem to be costing him politically. Democrats, in their indignant response, have moved so far toward what critics argue is a policy of open borders that they may unintentionally make this issue a net winner for Trump.

Trump’s foreign policy has been a disruptive megaphone, with little real success to show, but here again, he gets away with it. His approach has become predictable: He threatens fire and fury, imposes economic sanctions and then starts bargaining a deal that produces only modest gains. That’s been the case so far with North Korea, China and Mexico — and it’s probably where Trump wants to head with Iran.

If you were to do a cost-benefit analysis of Trump’s foreign policy, the damage he’s done to allies would far outweigh any gains against potential adversaries. But Trump doesn’t pay the cost because, for all his belligerent “America First” talk, he’s avoiding new wars and says he wants to withdraw from Syria and Afghanistan.

Polls suggest a continuing public distaste for Trump’s erratic, egoistic personal style, with 65 percent finding his behavior “unpresidential” in the Post-ABC News poll. The daily Trump show leaves the country exhausted and frazzled, and you can hypothesize a Democratic challenger who would be calming, trustworthy and unifying.

But looking at the Democratic field, it’s not clear yet who could actually deflate Trump’s balloon. The Democrats appear increasingly divided; they’re skewing further left as candidates compete for the party’s base; young progressives seem eager to pick fights with House Speaker Nancy Pelosi (D-Calif.) and other leaders. The public sadly seems almost as weary of Democrats’ investigations as of Trump’s scandals.

A Democrat who could, in theory, put a stopper in Trump’s bottle is former vice president Joe Biden. He has experience, talented advisers, support from labor and some other traditional Democratic constituencies, and money. What he doesn’t have is pizzazz.

Biden gave a solid foreign policy speech Thursday that was a reminder of what “normal” sounds like. His call for American leadership in the world was a reminder of how much damage Trump has done in abdicating that role.

Democrats should wake up: Like it or not, Trump is on something of a roll. Twenty candidates bickering onstage looks worryingly like a recipe for four more years.

Hillary Clinton thought Trump would beat himself, but she was wrong. The Democrat who can win in 2020 will be the one who presents a reassuring contrast to this loud but chronically insecure president. The polls say Trump is beatable, but it will take a strong, sensible campaign that can pull voters in the middle, where this race will be won or lost.

Read more from David Ignatius’s archive, follow him on Twitter or subscribe to his updates on Facebook.