Villagers can attempt to breed vertically through blocks like slabs and farmland (even with crops), but can't actually have a baby.
For some reason this doesn't work in a 1x1 space, so if you test, make sure to make a bigger space.
The pictures have barriers to keep the villagers in.
To be clear, I think the solution is to make them unable to attempt to breed through the blocks.