Set root page again after moving in sub page from tabs in ionic 4


My scenario is as below.

I have 4 tabs- tab1, tab2, tab3, and tab4. If I will navigate from the login page after login the tabs will open with active tab tab1. then I will navigate to tab 3.
From Tab3 I will navigate to page A->page B -> page C. From page C I want to set root tab3. then I start back navigation from android hardware back, then ideally it should not go to either page A, page B, or page C. But It is navigating to that pages.

for navigation , I am using this.router.navigate([‘X’, ‘a’, ‘b’]) and for setting roo I am using this.navCtrl.navigateRoot(‘A/B’,{ replaceUrl: true });

I want to use the hardware back button for subpages to go back but not from the root tab. I don’t want to navigate back from the tab to the login page.

Thanks in advance.