Automatic light in bathroom

If there’s a bathroom where if you walk in the light goes on , is it permitted to walk in on shabbos ?

Is that the only light?

Doesn’t Rav Abadi permit in his Or Yis-hak one to open the fridge door knowing that the light will turn on because of a necessity (i.e., food)? Is Goldylocks’ question any different?

Not exactly the same. The Ohr Yitzchak permits opening the refrigerator only if there is light in tbe room so you don’t care for or need the light in the refrigerator. If the room was dark it would not be permissible to open the refrigerator if the light inside would turn on since you very much want that light.