your images do not show how you are actually trying to accomplish your roof build or where it goes wrong. However, usually when placing roof over staircases you have to take into account the following:
- Between the roof and the staircase there has to be enough space for a sim to stand. (sim cannot hit his head on the roof). I see you placed your roof on the very outer edge of your floor. This will most likely not leave enough space for the sims to walk up the stairs without 'hitting the ceiling/roof' in any case.
- Even when you leave enough space, often dragging the roof over a staircase makes the stairs disappear. You can build a room around the staircase, place the roof and delete the walls (easiest way to see if the placement would work, the stairs will color yellow when holding the remove tool over the wall if it doesn't work). You could also drag the roof and (try to) replace the stairs afterwards.