It's the world that gets flipped instead of your control scheme. You keep holding right, and you go right-original, through the portal, then right-mirrored, but it's always right, so there's always agreement between the user's direction and the motion of Mario. You step the portal and the only the world reverses.