When the bottom part of the bed is the only way villager can reach the bed and there is a block on top of that bottom part of the bed, the villager can only reach the bed and sleep if the villager is on the left or right side of the bottom bed. if the villager is in front of the block, then it can't sleep on the bed, to make it sleeps, you need to nudge it.
Please check if this is still an issue for you in 1.16 Release Candidate 1 or later.