When onions and garlic are pulled, they should be dried a while. Here in this dry climate, just dropping them on the ground in the garden for a couple of days is sufficient, then they should be picked up, the tops cut off and bagged in mesh bags. The bags are best hung in a dry place like the garage or basement. Keep the air around them. I don't think light is a big concern, but humidity certainly is. Keep them dry.
Gardening at 5000 feet elevation, zone 4/5 Northern Utah, Frost free from May 25 to September 8 +/- Plant a Garden