Repository navigation
Form outline - #3636
Form outline#3636Crabcyborg wants to merge 25 commits into
Conversation
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
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. |
|
|
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.
There was a problem hiding this comment.
Request changes: the outline shows the wrong text for every ordinary field, and search matches hidden words. One blocking item.
Blocking:
js/src/admin/formOutline.js:18reads field names from.frm-label-textand falls back to.frm_primary_label's wholetextContent..frm-label-textdoes not exist in the builder's field markup (it is only created infieldPreviews.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 ofgetFieldTextwould have caught item 1. Psalmis red, but it is red onmastertoo (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.
| return headingText; | ||
| } | ||
|
|
||
| const label = field.querySelector( '.frm-label-text' ) || field.querySelector( '.frm_primary_label' ); |
There was a problem hiding this comment.
.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):
| 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.
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>
There was a problem hiding this comment.
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:
getPages()counts theend_dividermarker that every Section field adds to the builder. See the inline comment onformOutline.js:60.
Non-blocking:
- The
aria-livestatus counts only fields, so a search that matches only a section reads0 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.jsbuilds its Section fixture without anend_divider, so it cannot catch item 1. Add one tocreateFieldusage 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:
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 ) { |
There was a problem hiding this comment.
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:
| 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.
| } | ||
| status.textContent = fieldResultCount === MAX_FIELD_RESULTS | ||
| ? sprintf( __( 'Showing up to %d matching fields.', 'formidable' ), MAX_FIELD_RESULTS ) | ||
| : sprintf( __( '%d matching fields found.', 'formidable' ), fieldResultCount ); |
There was a problem hiding this comment.
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.
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>
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>
There was a problem hiding this comment.
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 GitHub now reports this branch as conflicting with |
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>
There was a problem hiding this comment.
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 tofb272481d. The merge only added master's changes (admin.jsfrom #3692,icons.svg,frm_admin.scss), none of which touch the outline. css/frm_admin.cssmatches a freshnpm run buildoutput.js/formidable_admin.jscontainsfrm-builder-outlineand notoReversed.- 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).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

No description provided.