Skip to content

Fix createSelect().enable() resetting the selected option - #9399

Open
pedrohpalma wants to merge 1 commit into
processing:mainfrom
pedrohpalma:fix-select-enable-resets-selection
Open

pedrohpalma wants to merge 1 commit into
processing:mainfrom
pedrohpalma:fix-select-enable-resets-selection

Conversation

@pedrohpalma

Copy link
Copy Markdown

Resolves #9388

Changes:

  • src/dom/dom.js: removed the selected = false assignments from both branches of enable() (enable() and enable(option)), so it now only changes the disabled state. disable() is unchanged.
  • src/dom/dom.js: added one sentence to the createSelect() reference saying that enabling a dropdown or option doesn't change which option is selected.
  • test/unit/dom/dom.js: added two tests in the createSelect suite. They check that the selected option is preserved after disable() + enable() and after enable(option). They fail without the fix.

Screenshots of the change:

PR Checklist

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]: createSelect().enable() resets the selected option to the first one

1 participant