Replaced bathroom fan/light
The black wire that is hooked up to the blue wire that keeps the light on, that is your always hot. Follow that wire back to the encasement and the white wire coming out of that encasement is your neutral. Hook that neutral up to only the white wires coming out of the fixture. Now take your always hot black and hook it to the remaining white wire in the other encased cable and mark it with some black tape. That wire now energizes the switch. Take the black wire in that encased cable and hook it up to the black wire and the blue wire from your fixture. Both fan and light should come on when operating the switch. Naturally, you want to turn off the power when you do any of this.