fix: compat V14 - _onFirstRender (HTMLElement.show), fermeture dialog TMR

This commit is contained in:
fabres
2026-07-27 21:17:50 +02:00
parent d8cfd02807
commit 3758d0ca85
3 changed files with 17 additions and 2 deletions
+4 -1
View File
@@ -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();
}
}
/* -------------------------------------------- */
+11
View File
@@ -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()
+2 -1
View File
@@ -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();
}
}