From 523bbff172822601570c8867ab53c1d72fd3ce97 Mon Sep 17 00:00:00 2001 From: Don Kendall Date: Fri, 27 Feb 2026 19:40:42 -0700 Subject: [PATCH] Fix toggle_attribute disabled check for checkbox inputs Use the computed `value` and `dataValue` variables instead of raw `event.target.value` and `this.dataset.value` when setting the disabled state on hidden inputs. For checkboxes, event.target.value returns the HTML value attribute (e.g. "true") rather than the checked state, causing the disabled toggle to always evaluate incorrectly. Co-Authored-By: Claude Opus 4.6 --- app/javascript/elements/toggle_attribute.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/javascript/elements/toggle_attribute.js b/app/javascript/elements/toggle_attribute.js index 5ff6b7c3..4305e2fe 100644 --- a/app/javascript/elements/toggle_attribute.js +++ b/app/javascript/elements/toggle_attribute.js @@ -14,7 +14,7 @@ export default class extends HTMLElement { this.target.classList.toggle(this.dataset.className, value !== dataValue) if (this.dataset.className === 'hidden' && this.target.tagName === 'INPUT') { - this.target.disabled = event.target.value !== this.dataset.value + this.target.disabled = value !== dataValue } }