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

[#65298] Fix broken top bar menus on form errors

Alexander Brandon Coles7878db1dedb2
diff --git a/frontend/src/app/app.module.ts b/frontend/src/app/app.module.ts
index 7625730f27a..5a37cc9cff7 100644
--- a/frontend/src/app/app.module.ts
+++ b/frontend/src/app/app.module.ts
@@ -217,13 +217,16 @@ export function initializeServices(injector:Injector) {
// Conditionally add the Revit Add-In settings button
injector.get(RevitAddInSettingsButtonService);
- topMenuService.register();
- contextMenu.register();
-
- // Re-register on turbo:load
- document.addEventListener('turbo:load', () => {
+ const runOnRenderAndLoad = () => {
topMenuService.register();
contextMenu.register();
+ };
+ runOnRenderAndLoad();
+
+ // Register on turbo:render, turbo:load
+ document.addEventListener('turbo:render', runOnRenderAndLoad);
+ document.addEventListener('turbo:load', () => {
+ runOnRenderAndLoad();
currentProject.detect();
});
diff --git a/frontend/src/turbo/turbo-global-listeners.ts b/frontend/src/turbo/turbo-global-listeners.ts
index 8ad1914e8fd..aa137821a81 100644
--- a/frontend/src/turbo/turbo-global-listeners.ts
+++ b/frontend/src/turbo/turbo-global-listeners.ts
@@ -15,7 +15,7 @@ import {
} from 'core-app/core/setup/globals/global-listeners/setup-server-response';
export function addTurboGlobalListeners() {
- document.addEventListener('turbo:load', () => {
+ const runOnRenderAndLoad = () => {
// Add to content if warnings displayed
if (document.querySelector('.warning-bar--item')) {
const content = document.querySelector('#content') as HTMLElement;
@@ -63,7 +63,9 @@ export function addTurboGlobalListeners() {
focusFirstErroneousField();
activateFlashNotice();
activateFlashError();
- });
+ };
+ document.addEventListener('turbo:render', runOnRenderAndLoad);
+ document.addEventListener('turbo:load', runOnRenderAndLoad);
document.addEventListener('turbo:before-morph-element', (event) => {
const element = event.target as HTMLElement;