Skip to content

Comments

re-enabling on invalid#221

Open
KonnorRogers wants to merge 1 commit intomainfrom
konnorrogers/fixing-reenabling-on-invalid
Open

re-enabling on invalid#221
KonnorRogers wants to merge 1 commit intomainfrom
konnorrogers/fixing-reenabling-on-invalid

Conversation

@KonnorRogers
Copy link
Owner

Status

  • Needs review

Related Issue(s)

We should still disable, but this re-enables if it detects an invalid event.

@netlify
Copy link

netlify bot commented Jan 20, 2026

Deploy Preview for mrujs canceled.

Name Link
🔨 Latest commit 8e5cecd
🔍 Latest deploy log https://app.netlify.com/projects/mrujs/deploys/696f066d0ef44200086a192a

@tcannonfodder
Copy link

tcannonfodder commented Jan 25, 2026

(Copying my comments from when we first chatted so they don't get lost)

I thought about taking this approach as well, but it could break cases where someone has disabled the input independently. such as, a form is disabled until it is fully valid; for example: a login form that is only valid when an email & password are enabled, so the user has disabled the submit button until the form is valid.

When you test this behavior with submit inputs, it doesn’t appear to trigger the disable handler at all; so I think we’d want to mirror that behavior for the button elements as best as we can by just not running the code.

Essentially, I'm thinking about how the event doesn't trigger if a submit input is used. And I think that the submit event doesn't fire if constraint validation kicks in. If so, following that logic, I think it makes sense to not disable since we should not have reached that point.

@tcannonfodder
Copy link

tcannonfodder commented Jan 28, 2026

I had some time this morning and updated my reproduction of this bug to show how "re-enabling on invalid" can break the behavior of forms that independently disable submit buttons. Code: practical-computer/mrujs-constraint-validation-bug-proof-of-concept@7f03da8

In the demo, I've created a simple "toggle lock" that disables specific submit buttons. In the non-remote form, the toggle-locked button remains locked, while in the remote form it is unlocked.

Demo video of "re-enabling on invalid" bug

Screen.Recording.2026-01-28.at.07.25.43.mov

Demo video of "halt disabling if the parent form is invalid & uses constraint validation" (#220)

Screen.Recording.2026-01-28.at.07.32.33.mov

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants