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

Correctly remove dialog or dialog-helper from dom on close

Oliver Günther44bad9d005ba
diff --git a/frontend/src/turbo/dialog-stream-action.ts b/frontend/src/turbo/dialog-stream-action.ts
index fa26d05c3ac..d28b257050f 100644
--- a/frontend/src/turbo/dialog-stream-action.ts
+++ b/frontend/src/turbo/dialog-stream-action.ts
@@ -3,7 +3,6 @@ import { StreamActions, StreamElement } from '@hotwired/turbo';
export function registerDialogStreamAction() {
StreamActions.dialog = function dialogStreamAction(this:StreamElement) {
const content = this.templateElement.content;
- const parent = content.firstElementChild as HTMLElement;
const dialog = content.querySelector('dialog') as HTMLDialogElement;
// Set a temporary width so the dialog reflows after opening
dialog.style.width = '0px';
@@ -14,7 +13,13 @@ export function registerDialogStreamAction() {
dialog.showModal();
// Remove the element on close
- dialog.addEventListener('close', () => parent.remove());
+ dialog.addEventListener('close', () => {
+ if (dialog.parentElement?.tagName === 'DIALOG-HELPER') {
+ dialog.parentElement.remove();
+ } else {
+ dialog.remove();
+ }
+ });
setTimeout(() => {
dialog.style.removeProperty('width');
diff --git a/modules/meeting/app/components/meetings/side_panel/state_component.html.erb b/modules/meeting/app/components/meetings/side_panel/state_component.html.erb
index 4aa3cfd6b85..be11f3507b4 100644
--- a/modules/meeting/app/components/meetings/side_panel/state_component.html.erb
+++ b/modules/meeting/app/components/meetings/side_panel/state_component.html.erb
@@ -66,6 +66,7 @@
end
if edit_enabled?
+ section.with_footer_button(
closed_state.with_row(mt: [0, 3, 3, 3, 3]) do
form_for(@meeting, method: "put", url: change_state_meeting_path(@meeting),
data: { 'turbo-stream': true }) do |f|