MOBILE-4061 core: Fix header not found when navigating from custom URL

main
Pau Ferrer Ocaña 2022-05-11 16:25:26 +02:00
parent cc3c8906c6
commit 51158f4323
1 changed files with 9 additions and 2 deletions

View File

@ -208,10 +208,17 @@ export class CoreNavBarButtonsComponent implements OnInit, OnDestroy {
await content.componentOnReady();
}
parentPage = parentPage.parentElement.closest('.ion-page');
parentPage = parentPage.parentElement.closest('.ion-page, .ion-page-hidden, .ion-page-invisible');
// Check if the page has a header. If it doesn't, search the next parent page.
const header = parentPage?.querySelector<HTMLIonHeaderElement>(':scope > ion-header');
let header = parentPage?.querySelector<HTMLIonHeaderElement>(':scope > ion-header');
if (header && getComputedStyle(header).display !== 'none') {
return header;
}
// Find using content if any.
header = content?.parentElement?.querySelector<HTMLIonHeaderElement>(':scope > ion-header');
if (header && getComputedStyle(header).display !== 'none') {
return header;