In my product, there is a feature where an admin can sign into the customer's account and manage their settings. (ex: Admin can sign into user's account and change their name) I currently have the design where the dashboard is exactly the same, with a header on top letting the user know what acc they are signed into and an "X" to leave that account. I am curious about the expected behavior when the user refreshes on this page. Should the admin stay signed into the customer acc, or since it looks like an overlay with the "X" should it close and be back to the admin acc? Here is a rough wireframe of my design:
You should keep the user with the account they were using. This is very common in server panels when using an admin account and acting as another user; if you reload, you'll still be in that user account. Just imagine the chaos if you were taken to your admin account without noticing it!
Another common example is Google Analytics and Google Ads. You may have a master account and then different subaccounts and even properties. When using either a subaccount or a property, you'll always remain in that subaccount until you log out or end the session.