What a damn shame.

The return of “Roseanne” brought working-class Midwesterners back into the TV fold and shook up an entertainment ecosystem dominated by coastal elites.

But Roseanne Barr, with her loudmouthed, racist tweet, wrecked any progress the show that bears her name made.

On Tuesday, Barr wrote a reprehensible post on Twitter, “Muslim brotherhood & planet of the apes had a baby=vj,” referring to Obama adviser Valerie Jarrett, who is African-American. Hours later, her ABC comedy was rightly canceled, despite strong ratings and reviews.

With that one totally thoughtless tweet, Barr lost her job and destroyed her own, already rocky reputation. Worse yet, she obliterated any chance of getting more honest depictions of working-class Americans on TV.

“Roseanne”‘s detractors — who have spent the last several months seething over the show’s success — won’t learn an iota from its many achievements and huge ratings. Instead, networks will focus squarely on its star’s moral failures, and nix any middle-class stories that look an ounce like it going forward.

Much to the Left’s chagrin, “Roseanne” was the best TV revival so far: funny, moving and, above all else, unifying. It didn’t look like it was shot through an Instagram filter, it didn’t take place in a dystopian hellscape and there was nothing prestigious about it whatsoever. The Conners were a normal Midwestern family who went through genuine American struggles — living paycheck to paycheck, losing work and dealing with a cranky dinner table.

Roseanne’s sister Jackie, played by Laurie Metcalf, was a bitter Hillary voter who didn’t speak to her for months — but they managed to mend the fence. In one episode, her grandson enjoyed dressing up in women’s clothes. Roseanne was confused at first, but in the end the loving grandma protected him from bullies. “Roseanne” delivered what it promised.

Still, the Twitterati were doing the Schadenfreude Shuffle Tuesday. “Roseanne’s network wanted to showcase the average Trump voter. And that’s exactly what they got,” journalist Molly Knight tweeted to her 91K followers. “I’m glad Roseanne is canceled,” said another tweet from writer/performer Kumail Nanjiani. “Nothing good has come of this entire thing.”

That, unfortunately, will likely be the prevailing opinion in Tinseltown. What a damn shame that Barr couldn’t keep her own moronic Twitter ramblings in check, and let her excellent show do the talking instead.