This quote from a 1960 study called "The Visual Cliff" is priceless: "Evidently infants should not be left close to a brink, no matter how well they may discriminate depth."
Indeed. Would you like a slice of Captain Obvious Cake to go with that tentative safety recommendation? Parents – your babies should be able to keep themselves from falling off stuff, but just in case ...
The study, for all its "well, duh" conclusion, was pretty crafty in execution. It used a flat, raised surface, half of it clear glass the other half plywood covered by a patterned cloth. A board ran down the junction, and that's where they started the babies off. Moms would stand on one end or the other, calling to their infants and trying to bribe them with promises of pretty pinwheels. Most of the babies didn't want to venture onto the glass. But a few also engaged with the glass, despite eventually heading in the right direction, whether by leaning on and peering through it, or accidentally scooting back legs onto it while preparing to take off for the safe side.
So while babies might be able to perceive depth, they're not always so smart about what to do when they encounter it. Shocker. Go buy a baby gate and really stick it to science.