Skip to content

Form outline - #3636

Draft
Crabcyborg wants to merge 25 commits into
masterfrom
form_outline
Draft

Crabcyborg wants to merge 25 commits into
masterfrom
form_outline

Conversation

@Crabcyborg

Copy link
Copy Markdown
Contributor

No description provided.

@coderabbitai

coderabbitai Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • 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

@deepsource-io

deepsource-io Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

DeepSource Code Review

We reviewed changes in ab4ee48...f303e06 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 ↗

Important

Some issues found as part of this review are outside of the diff in this pull request and aren't shown in the inline review comments due to GitHub's API limitations. You can see those issues on the DeepSource dashboard.

PR Report Card

Overall Grade   Security  

Reliability  

Complexity  

Hygiene  

Code Review Summary

Analyzer Status Updated (UTC) Details
PHP Nov 18, 2026 7:59p.m. Review ↗
JavaScript Nov 18, 2026 7:59p.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.

@franky-the-going-merry franky-the-going-merry Bot added the franky-working Franky is actively reviewing this label Oct 28, 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.

Request changes: the outline shows the wrong text for every ordinary field, and search matches hidden words. One blocking item.

Blocking:

  1. js/src/admin/formOutline.js:18 reads field names from .frm-label-text and falls back to .frm_primary_label's whole textContent. .frm-label-text does not exist in the builder's field markup (it is only created in fieldPreviews.js), so every field takes the fallback. See the inline comment.

How I checked: loaded the PR head (c314bc2) in the preview env, seeded a 13-field form with 2 page breaks and an HTML field, opened the builder and the outline. Page and field buttons read Page 1: Field 1 text * (Collapsed) (3) and Field 12 url * (Collapsed); typing collapsed in the search matches 11 fields. Clicking a field result worked: it scrolled to the field, highlighted it and opened its settings panel.

Non-blocking:

  • There is no automated test for the new formOutline.js (page grouping, search, the 60-result cap), and a test of getFieldText would have caught item 1.
  • Psalm is red, but it is red on master too (last three runs), so I did not count it. The other CI jobs are skipping on this draft.

Not exercised: collapsed-page expansion on click, form with fields added after page load (the outline only renders when the form has 10+ fields at load), keyboard/screen-reader behavior, and the bin/build-plugin.sh change. The js/formidable_admin.js and css/frm_admin.css build output was loaded and ran, but not diffed against a fresh npm run build.

Comment thread js/src/admin/formOutline.js Outdated
return headingText;
}

const label = field.querySelector( '.frm-label-text' ) || field.querySelector( '.frm_primary_label' );

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.

.frm-label-text is not in the builder markup, so this falls through to .frm_primary_label, whose textContent also contains the required asterisk (present even when hidden) and the (Collapsed) sub-label. Real builder label:

<label class="frm_primary_label" id="field_label_6">
  <span class="frm_builder_field_name">Field 1 text</span>
  <span class="frm_required frm_hidden">*</span>
  <span class="frm-sub-label frm-collapsed-label">(Collapsed)</span>
</label>

Result in the live builder: outline entries read Field 1 text * (Collapsed) and a search for collapsed matches every field. Read the name element only (it is also what admin.js uses at line 4434):

Suggested change
const label = field.querySelector( '.frm-label-text' ) || field.querySelector( '.frm_primary_label' );
const label = field.querySelector( '.frm_builder_field_name' );

The same label text feeds getPages() for the page title, so it fixes the Page N: Field 1 text * (Collapsed) (3) titles too. The HTML-field check below still works, since the HTML field's name is rendered the same way.

@franky-the-going-merry franky-the-going-merry Bot removed franky-review franky-working Franky is actively reviewing this labels Oct 28, 2026
Crabcyborg and others added 7 commits October 28, 2026 16:28
Show the outline as a third tab beside Add Fields and Field Options,
for every form instead of only forms with 10 or more fields. Jumping
to a field no longer selects it, so the outline stays open.

Field previews printed the label without its name span, so the outline
read the required and collapsed markers as part of the name. Renaming
a preview field also wiped those markers. Wrap the name like the PHP
markup does.

Add empty states for forms without fields, forms without pages or
sections, and searches with no results. Find HTML fields by their
default name, skip the submit button, list sections once, and show a
page when only one of its sections matches.

Add a Cypress spec for grouping, search, the result cap and labels.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@franky-the-going-merry franky-the-going-merry Bot added the franky-working Franky is actively reviewing this label Oct 28, 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.

Request changes: the label fix from my first review works and the sidebar tab is a good home for this, but the hidden section-end marker is counted as a field, so page counts are off and an ID search can return a blank row. One blocking item.

Blocking:

  1. getPages() counts the end_divider marker that every Section field adds to the builder. See the inline comment on formOutline.js:60.

Non-blocking:

  • The aria-live status counts only fields, so a search that matches only a section reads 0 matching fields found. while a row is shown (formOutline.js:213).
  • A page with no titled field reads Page 2: Page 2 (formOutline.js:123).
  • formOutline.cy.js builds its Section fixture without an end_divider, so it cannot catch item 1. Add one to createField usage and assert the page count.

How I checked: loaded the PR head (773e5c1) in the preview env and seeded a form with 3 pages, a Section holding one field, an HTML field, and collapsed fields. The previous bug is fixed: names read Field 5 text, and searching collapsed returns No results. Clicking a result in a collapsed page expanded it, highlighted the field and kept the outline tab open. The count problem reproduces:

Search for field ID 13 shows Page 1 counted as 8 and a blank row

Page 1 has 6 real fields plus the Section, but shows 8. Typing 13 (the end_divider's ID) returns an empty button.

Not exercised: the Cypress spec (CI is skipping on this draft), a collapsed Section, keyboard/screen-reader use, the bin/build-plugin.sh change, and the built js/formidable_admin.js/css/frm_admin.css against a fresh npm run build. The security pass found nothing new: PHP output is escaped, outline text is set with textContent, and the innerHTML in fieldPreviews.js replaces an insertAdjacentHTML with the same data. Psalm is red on master too.

const pages = [ { fields: [], breakField: null } ];
const fields = builder.querySelectorAll( 'li[data-fid]' );
fields.forEach( field => {
if ( field.dataset.type === SUBMIT_TYPE ) {

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.

A Section adds a hidden end_divider row to #frm-show-fields (li[data-type="end_divider"], no .frm_builder_field_name). It is counted in the page total and, because its text is empty, an ID search for its ID renders a blank frm-builder-outline-field button. Seeded form: Page 1 shows 8 for 6 fields plus a Section, and searching 13 returns an empty row.

Skip it the same way as the submit row:

Suggested change
if ( field.dataset.type === SUBMIT_TYPE ) {
if ( field.dataset.type === SUBMIT_TYPE || field.dataset.type === END_DIVIDER_TYPE ) {

Add const END_DIVIDER_TYPE = 'end_divider'; next to SUBMIT_TYPE on line 6.

Comment thread js/src/admin/formOutline.js Outdated
}
status.textContent = fieldResultCount === MAX_FIELD_RESULTS
? sprintf( __( 'Showing up to %d matching fields.', 'formidable' ), MAX_FIELD_RESULTS )
: sprintf( __( '%d matching fields found.', 'formidable' ), fieldResultCount );

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.

Non-blocking. The status line only counts field rows. Searching contact shows the Page 1 row and the Contact details Section row, but the live region announces 0 matching fields found. Count the Section rows too, or word the message as results rather than fields.

@franky-the-going-merry franky-the-going-merry Bot removed franky-review franky-working Franky is actively reviewing this labels Oct 28, 2026
Crabcyborg and others added 2 commits November 2, 2026 17:01
Moves the outline out of the sidebar tab into a popover opened from a
floating "Form outline" button at the bottom right of the builder canvas,
matching the floating buttons on the Styles page.

- Shows only once the form has a page break.
- Current page is marked with a bar as well as color.
- Arrow keys, Home/End and Enter navigate the results (Safari's Tab skips buttons).
- Search stays fixed while the list scrolls; focused rows get a visible ring.
- Page rows show a field count that leaves out sections and page breaks.
- A page named after its first section no longer lists that name twice.
- Sits above the bottom tab bar on screens under 960px.
- Adds the Iconic map icon to the sprite as frm_map_icon.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Crabcyborg and others added 4 commits November 4, 2026 10:59
Move the form outline to a floating button with a popover
The outline is now a third tab next to Add Fields and Field Options instead
of a floating button and popover. It lists every page (on multi-page forms),
section and field in form order, with search, and tracks the current page
while scrolling. The form switcher chevron uses grey-500 to match the header.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Move the form outline into an Outline tab in the builder sidebar
Array.prototype.toReversed() is ES2023 and outside the browserslist
target, so the outline would throw on older Safari and Chrome.
Array.from() already returns a fresh array, so reverse() is safe here.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@franky-the-going-merry franky-the-going-merry Bot added the franky-working Franky is actively reviewing this label Nov 12, 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 on fb272481d. The only note from my last review (toReversed() is ES2023) is fixed, and nothing else is open.

What changed since 4578bca47: formOutline.js now calls .reverse() on the array Array.from() already copied, with a one-line eslint-disable for unicorn/no-array-reverse that explains why. The committed js/formidable_admin.js has .reverse() and no toReversed. eslint js/src/admin/formOutline.js is clean, and a grep of js/src/admin/formOutline.js and fieldPreviews.js finds no other ES2023 method (toSorted, toSpliced, findLast, .at(), Object.groupBy).

Tests run: cypress run --spec tests/cypress/e2e/Forms/formOutline.cy.js at fb272481d (preview env on port 9400, Lite at this head, the repo's tests/mu-plugins installed, retries.runMode 0) → 4 passing, 0 failing. CI does not run this spec (draft), so this run is the only evidence. The spec covers the reversed section pass: it nests sections, drops empty non-matching ones and counts matches.

Not exercised: a real Section inside a Tabs panel in the builder (only the spec's hand-built DOM covers that path), keyboard and screen-reader use, a field added after page load, bin/build-plugin.sh, a rebuild of js/formidable_admin.js against npm run build, and PHPCS/PHPStan (CI skipped on the draft). I read only the one-line delta this round; the rest of the diff is unchanged since my last full read. security-review, simplify and code-review were not run on a one-line change. The delta adds no innerHTML.

@franky-the-going-merry franky-the-going-merry Bot removed franky-review franky-working Franky is actively reviewing this labels Nov 12, 2026
@Crabcyborg Crabcyborg added this to the 7.2 milestone Nov 12, 2026
@franky-the-going-merry franky-the-going-merry Bot added the franky-working Franky is actively reviewing this label Nov 12, 2026
@franky-the-going-merry

Copy link
Copy Markdown
Contributor

Franky: the franky-review label was added again, but the head is still fb27248, the commit I approved this morning, so there is nothing new to review. That Approve (with formOutline.cy.js 4/4 at that head) still stands.

GitHub now reports this branch as conflicting with master (mergeable state: dirty, 38 commits behind). It needs a merge or rebase before it can land. If the conflict resolution changes any code, push it and add franky-review again and I will re-review the new head.

@franky-the-going-merry franky-the-going-merry Bot removed franky-review franky-working Franky is actively reviewing this labels Nov 12, 2026
Resolve the conflicts in the compiled admin assets by rebuilding
css/frm_admin.css, js/formidable_admin.js and
js/formidable-settings-components.js from the merged sources.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@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 on fe3971f49. The only commit since my last Approve (fb272481d) is a merge of master into the branch. Nothing blocking, no new notes.

What I checked at this head:

  • The 12 source/test files this PR owns (formOutline.js, fieldPreviews.js, _outline_panel.php, add_field_links.php, edit.php, _form-outline.scss, _elements.scss, bin/build-plugin.sh, formOutline.cy.js) are byte-identical to fb272481d. The merge only added master's changes (admin.js from #3692, icons.svg, frm_admin.scss), none of which touch the outline.
  • css/frm_admin.css matches a fresh npm run build output. js/formidable_admin.js contains frm-builder-outline and no toReversed.
  • The merge left the branch 4 commits behind master, but GitHub reports it mergeable (the earlier "dirty" state is gone).

Tests run: cypress run --spec tests/cypress/e2e/Forms/formOutline.cy.js at fe3971f49 (preview env on port 9400, Lite at this head, Pro from 2026-11-06 active, the repo's tests/mu-plugins installed, retries.runMode 0) → 4 passing, 0 failing. CI does not run this spec (draft), so this run is the only evidence.

Not exercised: a byte-identical rebuild of js/formidable_admin.js (with my node_modules every bundle in the repo differs, including ones this PR does not touch, so the comparison says nothing); a real Section inside a Tabs panel; keyboard and screen-reader use; a field added after page load; PHPCS/PHPStan/ESLint (CI skipped on the draft); and the security-review/simplify/code-review skills (no PR-owned code changed since my last full read).

@franky-the-going-merry franky-the-going-merry Bot removed franky-review franky-working Franky is actively reviewing this labels Nov 16, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@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 at 7ebfd31. Re-review of the whole PR; my last Approve was at fe3971f. Still a draft with every CI job skipped, so only what I ran is covered.

What changed: only a second merge of master (the styler colour-format work from #3700). The 15 files this PR owns (formOutline.js, _outline_panel.php, the SCSS, built frm_admin.css, formidable_admin.js, formOutline.cy.js and the rest) are identical to the version I approved at fe3971f; the 12 files that differ are all master's (styles helpers, colour picker, their tests).

Tests run: cypress run --spec tests/cypress/e2e/Forms/formOutline.cy.js at 7ebfd31 against Lite (preview env, wp-preview-env.sh load lite 3636) → 4/4 passing.

Not run: byte-identical JS rebuild, keyboard/screen-reader pass, PHPCS/PHPStan, review skills (merge-only delta, PR files unchanged since the last full review). No new findings.

@franky-the-going-merry franky-the-going-merry Bot removed franky-review franky-working Franky is actively reviewing this labels 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 at 7ebfd31. The franky-review label was re-added with no new commit and no new comment since my last Approve, so this is the same head I already reviewed.

What I checked: head is 7ebfd31, same as my Approve at 17:08Z today. The 15 files this PR owns are unchanged from the version I approved at fe3971f. No author comments or review threads are open since then. No new findings.

Tests run: cypress run --spec tests/cypress/e2e/Forms/formOutline.cy.js at 7ebfd31 against Lite (preview env, wp-preview-env.sh load lite 3636) → 4/4 passing, in my review earlier today. Not re-run this round because the SHA is identical.

Not run: byte-identical JS rebuild, keyboard/screen-reader pass, PHPCS/PHPStan, review skills (nothing new to review). Visual check not exercised: no UI change since the last review. The PR is 29 commits behind master, and it is still a draft with every CI job skipped, so only what I ran is covered.

@franky-the-going-merry franky-the-going-merry Bot removed franky-review franky-working Franky is actively reviewing this labels Nov 16, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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