Skip to content

Fix createRadio().disable(false) not re-enabling radio inputs - #9438

Open
TheAgencyMGE wants to merge 2 commits into
processing:mainfrom
TheAgencyMGE:fix/radio-disable-false
Open

TheAgencyMGE wants to merge 2 commits into
processing:mainfrom
TheAgencyMGE:fix/radio-disable-false

Conversation

@TheAgencyMGE

Copy link
Copy Markdown

Fixes #9316

createRadio().disable(false) could never re-enable inputs: setAttribute('disabled', false) sets the attribute to the string "false", and presence of a boolean attribute means true.

  • disable() now sets radioInput.disabled = shouldDisable, matching createSelect and the checkbox checked() method in the same file
  • selected() no longer syncs the checked attribute, it sets option.checked only. No p5 code reads the checked attribute, selected() and value() read the .checked property only.
  • This intentionally drops checked attribute sync, so selected() no longer changes defaultChecked / form-reset behaviour; no p5 API documents or exposes that.

Tests: targeted DOM suite, xvfb-run -a npx vitest run test/unit/dom/dom.js --project unit-tests, 121 passed, 9 todo. Negative control: reverting only src/dom/dom.js made exactly the 2 behavior-locking tests fail. oxlint 0 warnings, 0 errors.

AI assistance disclosure: this PR was prepared with AI assistance and reviewed before submitting.

Verified with Gemini Neon, verdict ready to submit.

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.

[p5.js 2.0+ Bug Report]: createRadio().disable(false) does not re-enable radio inputs

1 participant