diff --git a/module/actor.js b/module/actor.js index c78baf5f..c1f3dcfc 100644 --- a/module/actor.js +++ b/module/actor.js @@ -2181,7 +2181,10 @@ export class RdDActor extends RdDBaseActorSang { } await this.deleteEmbeddedDocuments("Item", [rollData.signe.id]); await RdDRollResult.displayRollData(rollData, this.name, 'chat-resultat-lecture-signedraconique.hbs'); - this.tmrApp.close(); + if (this.tmrApp) { + this.tmrApp.subdialog = undefined; // débloque $forceClose qui refuse de fermer tant qu'un subdialog est actif + await this.tmrApp.close(); + } } /* -------------------------------------------- */ diff --git a/module/rdd-roll.js b/module/rdd-roll.js index 01b34837..465ae5e3 100644 --- a/module/rdd-roll.js +++ b/module/rdd-roll.js @@ -90,6 +90,17 @@ export class RdDRoll extends foundry.applications.api.DialogV2 { this.rollData = rollData } + async _onFirstRender(context, options) { + // DialogV2._onFirstRender calls this.element.show() which fails in V14 + // because this.element is HTMLElement (not jQuery). Override to use native DOM. + if (this.options.modal && typeof this.element.showModal === 'function') { + this.element.showModal(); + } else if (this.element?.style) { + if (this.element.style.display === 'none') this.element.style.removeProperty('display'); + this.element.classList.remove('hidden'); + } + } + _onRender(context) { super._onRender(context) this.bringToFront() diff --git a/module/rdd-tmr-dialog.js b/module/rdd-tmr-dialog.js index 4108bb28..8c704291 100644 --- a/module/rdd-tmr-dialog.js +++ b/module/rdd-tmr-dialog.js @@ -60,6 +60,7 @@ export class RdDTMRDialog extends foundry.applications.api.DialogV2 { title: "Terres Médianes de Rêve", content, classes: ["tmrdialog"], + window: { positioned: true }, position: { width: 'fit-content', height: 'fit-content' }, buttons: [{ action: "close", label: "Fermer", icon: "fa-solid fa-xmark", callback: () => this.close() }] }); @@ -182,7 +183,7 @@ export class RdDTMRDialog extends foundry.applications.api.DialogV2 { } bringSubDialogToFront() { - if (this.subdialog?.bringToFront && this.subdialog?.element && this.subdialog?.element[0]) { + if (this.subdialog?.bringToFront && this.subdialog?.element) { this.subdialog.bringToFront(); } }