CHICAGO — A plane headed to O'Hare Airport this week had to abruptly shift its path to avoid a midair collision with a glider, causing panic in the plane but ultimately cheers for the pilot.

The incident happened Monday on a United Airlines flight going from Vancouver to Chicago, according to the Points Guy, a travel-focused news site. The plane was headed to Chicago when "the right wing suddenly dropped out of nowhere and we made an extreme right turn," a passenger of the flight wrote to the Points Guy.

The flight-tracking service flightradar24 shows the plane made two circles above Beloit. A spokesman for the Federal Aviation Administration said the incident happened about 3:46 p.m. when the pilot spotted a glider near Rockford.

The pilot took the plane up about 400 feet and no contact was made with the glider, the spokesman said, citing preliminary information. The Federal Aviation Administration is investigating.

Passengers "shrieked and grabbed hold" of seats and arm rests, the passenger told the Points Guy, and some thought the plane's right engine had failed.

The plane evened out and, after about 10 minutes, landed at O'Hare.

That's when the pilot informed the passengers she'd had to "make an evasive maneuver to avoid a collision with another small aircraft," according to the Points Guy. The pilot said the other aircraft appeared to have been a glider.

The passengers cheered for the pilot, according to the Points Guy. The passenger told the website that United sent him an email apologizing for what had happened.

"United flight 246 from Vancouver to O’Hare landed safely and all passengers deplaned normally after the pilots deviated from the aircraft’s flight path because they spotted a glider," the airline told DNAinfo in an emailed statement. "We are following up with the FAA to do a complete review of what happened."

Other passengers tweeted about what happened:

The flight path of @united #246 as our talented pilot made evasive manoeuvres to avoid a collision with another plane on approach to Chicago pic.twitter.com/rqlE0JNrN2 — Callum Snape (@CalSnape) September 25, 2017

No, the pilot told us when we landed on the ground. We all panicked because of the sharp right turn and drop — Callum Snape (@CalSnape) September 25, 2017