Ed Balls, a Labour politician, made headlines when he appeared as a contestant on a television dance show, “Strictly Come Dancing.” He lacked polish, but the public praised him as a keen learner.

Two years before becoming prime minister, when she was home secretary, Mrs. May gave a preview of her dance moves on the BBC’s “Desert Island Discs,” a popular radio program that has invited public figures, since 1942, to share eight recordings that they would take as castaways to a desert island.

“I thought when I was preparing this sort of list that I’d actually quite like something to perhaps jig up and down to or dance to a bit on this desert island,” she said.

“And my husband Philip and I are sort of the Abba generation, so it is a piece of Abba and I’ve chosen ‘Dancing Queen.’ ”