Microsoft Teams currently does not allow a custom app to remain active when a user switches to another tab.