Ken Levine, who lent his many talents to creating classic episodes of M*A*S*H, Cheers and Frasier, brought up the caught-in-an-elevator comedy trope in a recent article. He wrote:
It's a comedy staple and I've resorted to it many times. People trapped in an elevator. I've written scenes using that premise, directed scenes using that premise, and in improv class I've performed that scene almost as many times as "two people meet on a blind date".I wrote about these scenes before. My article references an ample number of elevator scenes, but a few elevators scenes were overlooked in my research at the time. Let me now bring those scenes to light.
Hey, it works. You can get two people together who otherwise wouldn't be and place them in a highly stressful situation that they can't escape and could lead to a complete emotional and physical breakdown. What could be more fun than that?
You got panic jokes, claustrophobia jokes, indigestion jokes (always a crowd pleaser!), trying to be stoic, pleading with God, and don't forget those million-dollar sight gags. Attempting to open elevator doors or climb through the ceiling. Throw in a pregnant woman going into labor and no air conditioning and you've got comedy GOLD my friend!!!
Night Court used the trope twice. First, it came up in the 1984 episode "The Blizzard." This time, the twist is that womanizer Dan Fielding (John Larroquette) finds it distressing to be trapped in an elevator with a gay man.
The writers must have decided that no one would notice they were recycling the elevator idea when they used it again six years later in the 1990 episode "The Blues of the Birth." This time, one of the people trapped in the elevator is a pregnant woman who suddenly goes into labor.
Frasier ("Perspectives On Christmas," 1997)
Niles is crowded into an elevator with an unpleasant assortment of people and an oversized Christmas tree.
Moonlighting ("Between a Yuk and a Hard Place, 1988)
Burnistoun, a Scottish sketch comedy series, provided a funny alternative to the standard trapped-in-an-elevator routine.