Musicals have taken over the box office, whether moviegoers know it or not.

Some of the biggest movie releases in recent months including “Wonka” and “Mean Girls” feature song and dance numbers. But in their trailers, the show tunes don’t take center stage. That left some viewersconfused when characters burst into song.

“I was totally duped,” said Grace Beers, a 36-year-old real-estate agent from Livingston, Mont.

Beers said she likes musicals, when she is ready for them. That wasn’t the case when she saw “Mean Girls” with her fiancé in January and the person on screen launched into the opening number. “She started singing, and we instantly looked at each other and we were like, that’s a weird way to start it,” Beers said.

The songs kept coming. Beers and her fiancé didn’t make it to the end. Afterward, they re-watched the trailer to see whether they had misseda spoiler about the show tunes.

“There was no warning,” Beers said.

“Mean Girls” is a remake of the 2004 hit, a nonmusical comedy that Beers loved, and an adaptation of the 2018 Broadway musical based on the movie.

Paramount Pictures said its exit polls found that three-quarters of viewers on opening weekend knew the latest “Mean Girls” was a musical before seeing it. Warner Bros., the studio behind “Wonka,” declined to comment.

Marketers are trying to reach the widest possible audience, with theater attendance lingering below where it was before the Covid-19 pandemic. Domestic box-office earnings of some $9 billion in 2023 were more than in the past few years but down from $11 billion in 2019, according to box-office tracker Comscore.

Moviemakers know musicals can be polarizing. They include classics and monster hits such as “The Sound of Music,” and “Frozen.” But some recent adaptations, such as the 2019 movie “Cats,” fell flat at the box office.

“Mean Girls” has spent three weekends at the top of the box office since its Jan. 12 release, with a domestic gross of some $60 million. “Wonka,” released Dec. 15, has earned $195 million domestically. “The Color Purple” has earned $60 million domestically since Christmas, Comscore data show.

“A lot of people who are walking out of musicals and loving them may not even know that it was a musical,” said Paul Dergarabedian, a senior media analyst at Comscore.

Desiree Nguyen approached “Mean Girls” with mixed emotions.

Nguyen, 28, who lives in Anaheim, Calif., and majored in theater in college, knew the updated “Mean Girls” was a musical before she saw it with her sister. Her sister doesn’t usually watch musical movies, but liked it more than expected. Nguyen wished it had even bolder Broadway energy.

“Everybody likes to hate on musicals, but the truth is nobody actually hates musicals,” Nguyen said. “They just haven’t found one they like yet.”

Shauna Greeneremainsunconverted.

“I’m not one to sit there and be sung to unless I’m in church,” said Greene, 40, a barbershop owner in Greensboro, N.C. “I like music. I just don’t like music in the movies.”

Greene is a fan of the singer and actor Fantasia Barrino, so she went with her daughter to see her in “The Color Purple.” Greene had heard the movie was a musical. But her daughter was unprepared. She kept asking how many songs were left. Toward the end, the 21-year-old hit her limit and left to wait outside.

Barrino was phenomenal, Greene said. Butthe musical wasn’t her favorite. “I wouldn’t go if someone paid me to see it again.”

Daniel Loria went with his wife to see “Cyrano,” a romantic drama and musical starring Peter Dinklage, in New York City in 2022. After about five minutes and two songs, a couple sitting in front of them loudly asked if there would be singing the entire time.

How well an unexpected tune goes over depends on the film, said Loria, a senior vice president at The BoxOffice Company, a ticketing and showtime provider for social-media platforms.

“Being pleasantly surprised in ‘Barbie’ is one thing,” said Loria. “Imagine buying a ticket to ‘Oppenheimer’ and there are three musical numbers in there.”

Jim Bingham, 60, wanted to be surprised by the new “Wonka” movie. The banker from Rockville Centre on Long Island dragged his sons, who are in their mid-20s, to see it before Christmas because of the nostalgia he felt for the original film starring Gene Wilder. None of them knew it was a musical. His sons would have protested if they had, Bingham said.

They all left content. I was ready for anything,” Bingham said.

Other fans said they had seen enough clues in the teasers to catch the musical drift.The logo for the new “Mean Girls” movie hasa musical note embedded in it. The new versions of “Mean Girls” and “The Color Purple” were adapted from Broadway shows, and earlier “Wonka” movies also came equipped with songs.

Cameron Woods, a 30-year-old kindergarten teacher in Little RockArk., didn’t get the hint before he went to see “Mean Girls” on Jan. 19. He did think it was a bit strange to remake the original movie so soon. When the first song hit, Woods, who prefers horror movies, found it surprisingly catchy.

“For a musical, it was actually really good,” he said.

Later, he downloaded the soundtrack on Apple Music.

Write to Brianna Abbott at brianna.abbott@wsj.com