You step into the bathroom and the barking starts. Your dog may be frustrated by a closed door, worried about separation, or responding to a familiar routine that predicts you will leave the house. The sound alone cannot settle which.
Watch a brief, safe episode or record it. Does your dog wait at the door and settle, or do they pace, pant, scratch, drool, and remain distressed? Are they calm when you leave through the front door, or does that cause the same reaction? If they panic, try to escape, or risk injury, speak with your veterinarian and a qualified behavior professional. Do not leave them behind a door for longer and longer periods to force adaptation.
Make the easy version really easy
If they are otherwise comfortable, practice stepping behind an inside door for a moment and returning before barking begins. Reward calm behavior, gradually change just one thing, such as the door gap or duration. Let your dog choose a comfortable resting spot when you are nearby. If closing the door immediately triggers distress, start with a partial movement toward it and get professional help with pacing.
When you need privacy or must leave, arrange a safe management plan that avoids repeated panic where possible. A chew may help a relaxed dog but a distressed one may not eat. Your goal is not to stop the noise while leaving the fear in place. It is to understand which separation your dog finds hard and make that one smaller. If the recording shows distress whenever a door separates you, the separation-anxiety guide gives a longer dog-paced plan to discuss with qualified help
Sources: Dogs Trust: Separation anxiety in dogs. ASPCA: Separation Anxiety.