From d1cb412e5aa95d10f1c306279d68ade4e882a98b Mon Sep 17 00:00:00 2001 From: Oliver-Akins Date: Tue, 30 Apr 2024 21:31:11 -0600 Subject: [PATCH] Add event handling for the custom input elements --- module/sheets/Items/GenericItemSheet.mjs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/module/sheets/Items/GenericItemSheet.mjs b/module/sheets/Items/GenericItemSheet.mjs index 936bd6c..21d47a3 100644 --- a/module/sheets/Items/GenericItemSheet.mjs +++ b/module/sheets/Items/GenericItemSheet.mjs @@ -43,6 +43,15 @@ export class GenericItemSheet extends ItemSheet { if (!this.isEditable) return; console.debug(`.dungeon | Adding event listeners for Generic Item: ${this.id}`); + + /* + Custom element event listeners because Foundry doesn't listen to them by + default. + */ + html.find( + CONFIG.CACHE.componentListeners.map(n => `${n}[name]`).join(`,`) + ).on(`change`, () => this._onChangeInput.bind(this)); + html.find(`button[data-increment]`) .on(`click`, this._incrementValue.bind(this)); html.find(`button[data-decrement]`)