Skip to content

Fix multi-select deselect being undone when field is inside a Section - #3351

Open
vivi-the-going-merry[bot] wants to merge 1 commit into
masterfrom
fix/issue-6029-section-multiselect-deselect
Open

vivi-the-going-merry[bot] wants to merge 1 commit into
masterfrom
fix/issue-6029-section-multiselect-deselect

Conversation

@vivi-the-going-merry

@vivi-the-going-merry vivi-the-going-merry Bot commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

What

Ctrl/Cmd+Click (or Shift+Click) to deselect a field group in the builder's multi-select doesn't stick when the field is inside a Section — the group re-selects itself immediately. Reported against formidable-pro but the code is Lite's (free plugin label on the issue).

Root cause (mechanism confirmed, exact repro not fully pinned down)

fieldGroupClick is delegated on ul.frm_sorting from #frm-show-fields (js/src/admin/admin.js). A row's own ul.frm_sorting nests inside the form-wide one, and — for a field inside a Section — inside the Section's own ul.frm_sorting too. I confirmed via instrumentation that a single click on a nested ul.frm_sorting does invoke a delegated handler bound at document twice (once per matching ancestor), which is the double-invocation mechanism the original fix targeted.

Caveat: a synthetic-click test against the simplest repro I could build (two plain Text fields directly inside one Section, nothing merged into a row) did not reproduce the visible symptom against pre-fix master — the deselect worked correctly in that specific case, so I can't 100% confirm this is the exact trigger the issue reporter hit. The issue's own thread mentions "group selection" specifically, which may mean fields merged into one row (a frm-selected-field-group spanning >1 field) rather than a bare single-field row — that combination inside a Section is untested here. Flagging for reviewer verification against the original repro steps before merging, rather than blocking on further investigation.

Fix

Guard with a one-shot flag set on the event object (e.frmFieldGroupClickHandled), not e.stopPropagation() — this same click also needs to reach an unrelated document-level delegated handler (handleClickOutsideOfFieldSettings, bound on #frm_builder_page) that closes an open field-settings dropdown on outside click. stopPropagation() would silently break that. This guard is a no-op if the double-invocation this targets isn't actually happening for a given click, so it's safe to land even if it doesn't turn out to be the whole story.

Build note

No JS toolchain (node_modules) available in this environment to run npm run build, so js/formidable_admin.js was hand-mirrored — diffed byte-for-byte against HEAD's built file to confirm the only change is the exact new guard clause, nothing else drifted. node --check passes on both files.

Closes Strategy11/formidable-pro#6029

ul.frm_sorting nests (row inside section inside form), and this click
handler is delegated on the same event for every matching ancestor.
stopPropagation would also block the unrelated document-level handler
that closes an open field-settings dropdown on outside click, so guard
with a one-shot flag on the shared event object instead.

Closes Strategy11/formidable-pro#6029
@coderabbitai

coderabbitai Bot commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 69779a87-2f81-45cc-bde3-d54e59c6177d

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@deepsource-io

deepsource-io Bot commented Sep 16, 2026

Copy link
Copy Markdown

DeepSource Code Review

We reviewed changes in 2a2d8c1...b333150 on this pull request. Below is the summary for the review, and you can see the individual issues we found as inline review comments.

See full review on DeepSource ↗

PR Report Card

Overall Grade   Security  

Reliability  

Complexity  

Hygiene  

Code Review Summary

Analyzer Status Updated (UTC) Details
PHP Sep 16, 2026 11:49p.m. Review ↗
JavaScript Sep 16, 2026 11:49p.m. Review ↗

Important

AI Review is run only on demand for your team. We're only showing results of static analysis review right now. To trigger AI Review, comment @deepsourcebot review on this thread.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant