A mischievous high school comedy of errors, “Love, Simon” follows a 17-year-old senior who is approaching childhood’s end while facing a challenge tougher than college entrance exams. He hasn’t told his classmates, his close friends or his unsuspecting family that since puberty he has identified as gay. It’s a dilemma the film addresses in a winning, cheerful tone. If John Hughes had gone on to make a smart LGBT coming-of-age charmer, most likely it would resemble this.

Played by Nick Robinson in a treat of a performance, Simon hasn’t stayed in the closet because he was scared he might face disapproval from his close-knit family. When your sweetheart of a mother is played by Jennifer Garner, your good-natured doofus of a dad is Josh Duhamel and your adoring kid sister is young Talitha Bateman, you know you’re in pretty safe hands. Simon doesn’t expect anything worse than generic taunting from some of his school’s standard-issue blockheads. Crowd-pleasing films like this sugarcoat real-world challenges into irrelevance, so don’t worry.

He has been cautiously working on how and when to open up because his sexuality is still a bit puzzling. And it’s not anyone else’s business. Not yet.

Then he discovers a schoolmate with the pseudonym Blue writing online about being in the same situation with identical feelings. Simon, alias Jacques, begins a pen pal correspondence with Blue, eventually developing a soft spot that begins moving toward something like first love.

The film, adapted from Becky Albertalli’s YA novel “Simon vs. the Homo Sapiens Agenda,” makes it impossible not to root for Simon. He’s a well-rounded character who is both balanced and vulnerable. He’s into music (a fan of the Kinks and vinyl records), theater (he’s in the school production of “Cabaret,” which is, OK, a bit too on-the-nose) and romance — or, at least, the idea of romance.

Of course, love is never quite as easy as we hope, and falling in love with love itself is an especially bruising affair. By the time Simon passes through a gantlet of misunderstandings and makes it to the uplifting ending, it’s clear that he has earned it.

The film lacks the sophisticated genius of “Lady Bird,” but it never for a moment feels simplistic. It has a broad, noticeably diverse supporting cast and gracefully plays them off one another like carom shots rebounding in a billiards game. Simon isn’t the only person with romantic troubles or secrets, and Robinson isn’t the only performer who gets screen moments that are heart-clenching, or wildly funny, or both at once.

The script has a whiplash sense of humor that’s able to remain sort of family-friendly while making a stunningly gross joke about hummus dip and baby carrots. There’s not a sequence in it that feels dull or routine, and several that feel a wee bit berserk in a good way.