Skip to content

Keep the label markup in field previews drawn in the browser - #3706

Merged
Crabcyborg merged 4 commits into
masterfrom
fix/client-preview-label-markup
Nov 16, 2026
Merged

Crabcyborg merged 4 commits into
masterfrom
fix/client-preview-label-markup

Conversation

@Crabcyborg

Copy link
Copy Markdown
Contributor

Field previews drawn in the browser (the deferred previews from 5ed1a1949, not released yet) put the field name straight into the label. They had no frm_builder_field_name span, and the required indicator had no frm_required_indicator_{id} id. The PHP preview has both.

As a result, editing the field label replaced the whole label and removed the required asterisk, the tooltip indicator and the "(Collapsed)" tag. Changing the Required Indicator setting did not update the preview.

This makes the drawn markup match the PHP preview. It is split out of #3672 so it can go out with the next release, since the regression ships with the deferred previews otherwise.

Testing

  1. Open a form with enough fields that some previews are drawn after load (Online Submission, 300+ fields, on the dev site).
  2. Scroll to a required text field lower down and select it.
  3. Change its label. Before: the label became the bare text. After: the asterisk and the other label parts stay.
  4. Change its Required Indicator to !!. Before: nothing changed in the preview. After: the preview shows !!.

Verified in a browser on the dev site, with Pro active, against master's bundle (bug reproduced) and this branch's bundle (fixed). No new debug log entries.

js/formidable_admin.js is rebuilt, so it will conflict with other open builder PRs. Rebuild to resolve.

🤖 Generated with Claude Code

Previews drawn in the browser put the field name straight into the
label, with no frm_builder_field_name span, and left the required
indicator without its frm_required_indicator_{id} id. Live label
edits then replaced the whole label, removing the required indicator,
the tooltip indicator and the collapsed tag. Required indicator edits
did not reach the preview at all.

Match the PHP preview markup.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 43 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 1c2f3f0 and e9950ef.

Files selected for processing: 4

  • js/formidable-settings-components.js
  • js/formidable-web-components.js
  • js/formidable_admin.js
  • js/src/admin/fieldPreviews.js
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@Crabcyborg Crabcyborg added this to the 7.1 milestone Nov 16, 2026
@franky-the-going-merry franky-the-going-merry Bot added the franky-working Franky is actively reviewing this label Nov 16, 2026

@franky-the-going-merry franky-the-going-merry Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approve. Nothing blocking, no notes.

The drawn preview now builds the same label markup as show_label_on_form_builder() in PHP: the name sits in span.frm_builder_field_name and the required span carries frm_required_indicator_{id}. admin.js already writes live label edits into .frm_builder_field_name and the Required Indicator input already targets frm_required_indicator_{id}, so those two hooks now find their targets. The bundle matches the source: frm-label-text is gone, the new frm_builder_field_name assignment and frm_required_indicator_ id are in. Its other differences are webpack module ids, as usual after a rebuild. The label still goes through the same server-side kses + force_balance_tags as before, now via innerHTML on the span instead of insertAdjacentHTML, so no new injection path.

Live bug repro, before and after (preview env, Lite at master 76c0064 vs PR head c3672c1, form of 16 required text fields forced into the deferred/drawn path with a mu-plugin; field 14 selected):

Step master PR
Label markup after load Field 14 <span class="frm_required">*</span> … (bare text, no name span, no id on the indicator) <span class="frm_builder_field_name">Field 14</span> <span class="frm_required" id="frm_required_indicator_19">*</span> …
Edit label to Renamed 14 whole label replaced by the bare text Renamed 14; asterisk, collapsed tag and tooltip indicator gone name changes, asterisk, (Collapsed) tag and tooltip indicator stay
Required Indicator set to !! nothing changes (label stays Renamed 14) indicator span reads !!

PR head after both edits (field 14):

Preview of field 14 after renaming the label and setting the indicator to !!

Siblings checked on the PR, on both field 1 and field 14: a label of <b>Bold</b> & more renders as bold text inside the name span with the other parts intact; toggling Required hides and shows the indicator (frm_hidden added and removed); clearing the indicator leaves it empty.

Tests run: node --test tests/js/*.test.mjs at c3672c11e → 17 pass, 1 fail (style-live-preview.test.mjs: @babel/core isn't installed in the scratch checkout; it's a styler test the PR doesn't touch). CI on this PR shows every job as "skipping".

Not run: PHPCS/PHPStan/Oxlint, the 300+ field Online Submission form from the PR description, Pro-only field types in the drawn path, keyboard or screen-reader checks. No automated test covers the drawn label markup; the repo has no browser-less harness for fieldPreviews.js, so I did not ask for one.

Heads up, not a finding: the PR is 13 commits behind master and rebuilds js/formidable_admin.js, so it will conflict with any other builder PR that lands first (the description says the same).

@franky-the-going-merry franky-the-going-merry Bot removed franky-review franky-working Franky is actively reviewing this labels Nov 16, 2026
Crabcyborg and others added 2 commits November 16, 2026 14:47
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@deepsource-io

deepsource-io Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

DeepSource Code Review

We reviewed changes in 1c2f3f0...e9950ef 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 Nov 16, 2026 7:14p.m. Review ↗
JavaScript Nov 16, 2026 7:14p.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.

@Crabcyborg
Crabcyborg merged commit bfb1008 into master Nov 16, 2026
18 of 19 checks passed
@Crabcyborg
Crabcyborg deleted the fix/client-preview-label-markup branch November 16, 2026 19:13
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