The story
From the idea that a person painting the floor of a room may inadvertently apply the paint over the whole floor and trap themselves in a corner away from any exit, so that to leave the room the person has no choice but to step on the fresh paint and ruin it.
Etymology from Wiktionary, CC BY-SA 4.0.