Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Fix top-menu not registered

Oliver Güntherd79a587cf5a0
diff --git a/frontend/src/app/app.module.ts b/frontend/src/app/app.module.ts
index 3b73e49dacf..55acf26a7da 100644
--- a/frontend/src/app/app.module.ts
+++ b/frontend/src/app/app.module.ts
@@ -247,9 +247,14 @@ export function initializeServices(injector:Injector) {
injector.get(RevitAddInSettingsButtonService);
topMenuService.register();
-
PreviewTrigger.setupListener();
+ // Re-register on turbo:load
+ document.addEventListener('turbo:load', () => {
+ topMenuService.register();
+ PreviewTrigger.setupListener();
+ });
+
keyboardShortcuts.register();
return injector.get(ConfigurationService).initialize();
@@ -389,7 +394,7 @@ export class OpenProjectModule implements DoBootstrap {
ngDoBootstrap(appRef:ApplicationRef) {
this.runBootstrap(appRef);
-
+
// Connect ui router to turbo drive
document.addEventListener('turbo:load', () => {
this.runBootstrap(appRef);
diff --git a/frontend/src/app/core/top-menu/top-menu.service.ts b/frontend/src/app/core/top-menu/top-menu.service.ts
index 3859eaaadfc..4f266658200 100644
--- a/frontend/src/app/core/top-menu/top-menu.service.ts
+++ b/frontend/src/app/core/top-menu/top-menu.service.ts
@@ -26,15 +26,9 @@
// See COPYRIGHT and LICENSE files for more details.
//++
import { findAllFocusableElementsWithin } from 'core-app/shared/helpers/focus-helpers';
-import {
- Inject,
- Injectable,
-} from '@angular/core';
+import { Inject, Injectable } from '@angular/core';
import { DOCUMENT } from '@angular/common';
-import {
- BehaviorSubject,
- Observable,
-} from 'rxjs';
+import { BehaviorSubject, Observable } from 'rxjs';
export const ANIMATION_RATE_MS = 100;
@@ -44,7 +38,7 @@ export class TopMenuService {
private menuIsOpen = false;
- private menuContainer = this.document.querySelector<HTMLElement>('.op-app-header');
+ private menuContainer:HTMLElement;
private active$ = new BehaviorSubject<HTMLElement|null>(null);
@@ -52,6 +46,7 @@ export class TopMenuService {
}
register():void {
+ this.menuContainer = this.document.querySelector<HTMLElement>('.op-app-header') as HTMLElement;
this.setupDropdownClick();
this.closeOnBodyClick();
this.accessibility();