Thats a GR* idea
I just installed a foldable shelf on my fridge wall above the bed for a laptop and as a step for the cat to get to the top bunk to avoid the dog eating her food.I use the top bunk for storage .
I screwed in the hinge part on the horizontal beam(nice and sturdy)
The suport brace comes in a couple inches lower and is not suported.
I used a drywall ancor and used a 3 inch piece of a paint sturrer 3 M taped it on the wall and srewed thru to mount.( seams nice and sturdy)
The rivit way probobly would have been a better way.
I have one and a assortment of rivit sizes.
Harbor freight has guns/rivits cheap .
I rivit my dogs tags to his collar to avoid black stains on his fur
and that dam jingling
__________________