From 03b3b9fb0fd3aca18d2cb5869911726942e4c365 Mon Sep 17 00:00:00 2001 From: Oliver Date: Fri, 28 Nov 2025 19:54:14 -0700 Subject: [PATCH] Prevent the valueAttribute from being assigned to non-input types and clean up the branching --- module/utils/DialogManager.mjs | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/module/utils/DialogManager.mjs b/module/utils/DialogManager.mjs index ab330f3..081e248 100644 --- a/module/utils/DialogManager.mjs +++ b/module/utils/DialogManager.mjs @@ -60,18 +60,13 @@ export async function ask( i.id ??= foundry.utils.randomID(16); i.key ??= i.label; - switch (i.type) { - case `input`: { - i.inputType ??= `text`; - } - } - // Only ever allow one input to claim autofocus i.autofocus &&= !autofocusClaimed; autofocusClaimed ||= i.autofocus; // Set the value's attribute name if it isn't specified explicitly - if (!i.valueAttribute) { + if (i.type === `input`) { + i.inputType ??= `text`; switch (i.inputType) { case `checkbox`: i.type = `checkbox`; @@ -79,7 +74,7 @@ export async function ask( delete i.inputType; break; default: - i.valueAttribute = `value`; + i.valueAttribute ??= `value`; }; }; };