With the door open, the circuit is closed and whatever is on the circuit will have power to it (in this case, the dome light)
When something presses on it (your finger, or, under normal circumstances, the door) it presses the button and breaks the circuit, interrupting the path and shutting of the dome light