I added a little pantry to the many projects tied to a kitchen remodel. when I built the upper door, I had to limit its height, because a curtain rod, on the wall ninety degrees to it, obstructed opening it.
Keep in mind, my house has low ceilings, compromising the situation more.
In the end, it seemed I had only a few choices:
Leave the area above the door open, so things in the upper shelf could be accessed, but which would look unfinished; or,
In install a filler piece above the door, but which would make accessing things on the upper shelf all but impossible. Lowering the lower shelf would have made the upper shelf more usable, but would have made the lower less so.
The problem was solved when my wife suggested I play with an idea using some of my rare earth magnets. Using them, we merely reach up and pull the filler piece off to access the area.
The frame work both adds to the appearance, and acts as a stop, to keeps the filler from going in too far.