As a rule of thumb, mushrooms go into the pan first. Then, add the onions once the mushrooms are nicely browned and starting to caramelize.