fix: workaround for side menu items not being active on page load

This commit is contained in:
Thea Schöbl
2023-03-23 09:06:21 +00:00
committed by Rainer Killinger
parent 2220ab24b3
commit 947cab458c

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2022 StApps
* Copyright (C) 2023 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -12,7 +12,6 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {Directive, ElementRef, Input, OnDestroy, OnInit, Renderer2} from '@angular/core';
import {AnimationController, NavController} from '@ionic/angular';
import {Router, RouterEvent} from '@angular/router';
@@ -46,6 +45,12 @@ export class RootLinkDirective implements OnInit, OnDestroy {
ngOnInit() {
const animation = tabsTransition(this.animationController);
this.renderer.setAttribute(this.element.nativeElement, 'button', '');
if (document.querySelector('#main')?.childNodes.length === 1) {
if (this.router.url === this.rootLink) {
this.setActive();
}
this.needsInit = false;
}
this.subscriptions.push(
this.router.events.subscribe(event => {