Skip to content

Tweak - Form builder UI, survey import/export and add-on extension points - #29

Closed
SidTGV wants to merge 11 commits into
mainfrom
ui-rework-sid
Closed

SidTGV wants to merge 11 commits into
mainfrom
ui-rework-sid

Conversation

@SidTGV

@SidTGV SidTGV commented Nov 22, 2026 •

Copy link
Copy Markdown
Member

Form builder UI rework, survey import/export, add-on extension points, and fixes from review.

Hold for a later release. Not planned for the current one, please don't merge yet.

Form builder UI

  • Pages: shown as capsule tabs with one page visible at a time. Section actions are renamed to "page", and page titles and collapse are removed.
  • Questions: edited inline in the field row as plain text. The rich-text toolbar and the separate question area are gone.
  • Fields: each field is a single card, and only one field is expanded at a time. Enter or Escape ends editing in every builder input.
  • Preview: opens in Widget view with the page pager under the widget, uses a 60/40 builder/preview split, and stays in sync with the builder's current page in both directions.
  • Empty pages: selecting a page with no questions shows "This page has no questions yet. Visitors skip empty pages." in the preview instead of another page's questions.
  • Reset: returns both the preview and the builder to page 1.

Import / Export (free)

New tab under Tools > Import / Export.

  • Export: a searchable multiselect of surveys; downloads one JSON file.
  • Import: select a JSON file; each survey is created as a draft. Afterwards a notice reminds you to check the target pages, since page IDs differ between sites.
  • REST: GET /surveys/export?ids= and POST /surveys/import (admin only).

Add-on extension points (for AllFeedback Pro)

  • Extension slots in the form builder, widget and Settings page.
  • Surveys go offline when the add-on features they use are inactive.
  • Email question type with address validation.

Fixes

  • With conditional logic, a page no longer shows Submit when an unanswered question on it could still reveal later pages. Fixed in both the widget and the builder preview.
  • Consent checkbox class lost its space (allfb-option__checkboxis-checked), so it never looked ticked.
  • Preview width default is shared between the builder and its loading screen.

Tests

New tests/e2e/specs/building-forms/form-builder.spec.ts:

  • page tabs and the preview pager stay in sync
  • an empty page shows the empty-page state
  • Reset returns both views to page 1

It passed 3 out of 3 runs. With the fix removed, the empty-page and Reset scenarios fail on their assertions.

🤖 Generated with Claude Code

Sid Sharma and others added 3 commits November 19, 2026 17:09
- Show pages as capsule tabs with one page visible at a time; rename
  section actions to page and drop page titles and collapse.
- Edit questions inline in the field row as plain text; remove the
  rich-text toolbar and the separate question area.
- Merge each field into a single card; Enter/Escape ends editing in all
  builder inputs; only one field expanded at a time.
- Preview defaults to Widget view with the page pager under the widget,
  a 60/40 builder/preview split, and two-way page sync with the builder.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- JS filters: allfeedback.builder.fieldExtensions (field panels, header badges, warning outline) and allfeedback.form.visibleSections (widget + preview)
- PHP filters: allfeedback_admin_script_dependencies / allfeedback_frontend_script_dependencies so add-on scripts load first
- Field settings added by extensions are saved and loaded untouched
- Builder UI components shared on window.AllFeedback for add-ons

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Builder saves the add-on features a form uses in form_schema.requires (extensions declare feature + isUsedBy)
- New allfeedback_active_features filter; Survey::isLive() = published and every required feature active
- Widget, shortcode, block, public REST read, state and submit endpoints only serve live forms
- Builder banner, publish toast and forms-list "Inactive" badge explain why and how to fix it
- Saved status is untouched, so reactivating the add-on brings the form back automatically

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@tg-autopilot
tg-autopilot requested a lite review from Copilot November 22, 2026 08:32
@github-actions

Copy link
Copy Markdown

QA suite — refused, no regression spec

This PR changes product source but adds no spec, so the suite was
refused before booting WordPress — running it just to report the same
thing at the end costs runner minutes for nothing. Run
/claudegrill:verify-fix locally and let write-spec add the guard
to this branch, then push again.

The guard is a Playwright spec in the product's spec directory — not a
PHPUnit test and not a script under tests/manual/, which this check
cannot see. Logic with no browser surface can still be guarded there by
a spec that runs the PHP and asserts on its output.

If this change cannot have a spec — a payment webhook, cron, or
state the harness cannot create — a member of the organisation can
apply the qa-waived label. The suite then runs on what the diff
maps to, without the spec requirement.

Source files changed with no matching spec
resources/scripts/admin/pages/forms/FormBuilder.tsx
resources/scripts/admin/pages/forms/builder/BuilderCanvas.tsx
resources/scripts/admin/pages/forms/builder/FieldEditor.tsx
resources/scripts/admin/pages/forms/builder/PreviewPanel.tsx
resources/scripts/admin/pages/forms/builder/SectionCard.tsx

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

Active findings remain: the pending route uses stale width settings, empty-page selection breaks builder/preview synchronization, and reset or resubmit can leave the two views on different pages.

3 open issues
What changed in this PR

This pull request refreshes the React form-builder UI without changing PHP or persisted data structures. It introduces page-based navigation, inline question editing, single-field expansion, and a widget-first synchronized preview.

Changes:

  • Replaces section-oriented navigation with capsule-style page tabs and page actions.
  • Moves question editing inline and simplifies field configuration cards.
  • Updates preview defaults, pager placement, page synchronization, and builder/preview sizing.
File Description
resources/​styles/​admin.pcss Updates styling for the inline question editor.
resources/​scripts/​admin/​pages/​forms/​FormBuilder.tsx Connects shared active-page state and revises preview-width persistence and split sizing.
resources/​scripts/​admin/​pages/​forms/​builder/​SectionCard.tsx Converts sections into page cards and manages expanded fields.
resources/​scripts/​admin/​pages/​forms/​builder/​PreviewPanel.tsx Adds widget-first preview mode, pager placement, and builder/preview page synchronization.
resources/​scripts/​admin/​pages/​forms/​builder/​FieldEditor.tsx Adds inline question editing, keyboard blur behavior, field expansion, and simplified configuration interactions.
resources/​scripts/​admin/​pages/​forms/​builder/​BuilderCanvas.tsx Adds capsule page tabs, page selection, page rendering, and page management actions.

Review effort: Lite

key={s.id}
type="button"
draggable
onClick={() => selectSection(idx)}
Comment on lines +505 to +510
// User-driven navigation in the preview — mirror it in the builder.
const goToStep = (step: number) => {
setCurrentStep(step);
const id = steps[step]?.id;
const sectionIdx = sections.findIndex((s) => s.id === id);
if (sectionIdx >= 0) onActiveSectionChange?.(sectionIdx);
Comment on lines +397 to +404
const saved = localStorage.getItem('allfeedback_preview_width_v2');
if (saved) {
const n = parseInt(saved, 10);
if (!isNaN(n) && n >= 280)
return Math.min(n, Math.round(window.innerWidth * 0.72));
}
return Math.round(window.innerWidth * 0.3);
const adminMenu = document.getElementById('adminmenuwrap')?.offsetWidth ?? 0;
return Math.max(280, Math.round((window.innerWidth - adminMenu) * 0.4));
Sid Sharma and others added 6 commits November 22, 2026 18:18
- allfeedback.settings.advancedSections filter adds sections to the bottom of Settings → Advanced
- Switch shared with add-ons on window.AllFeedback.components
- CLAUDE.md: "form" and "survey" mean the same thing; say survey in new work

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

- Sections added via allfeedback.settings.advancedSections get the saved settings, their staged patch and setPatch()
- Staged patches mark the page unsaved and are merged into Save like free's own fields

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- New "Email" field in the builder (placeholder like text fields)
- Widget and builder preview check the address format before moving on
- Submissions with an invalid address in an email question are rejected on the server (is_email)
- Dev-tools sample responses fill email questions

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Selecting an empty page now shows an empty-page state in the preview,
Reset returns the builder to page 1 too, and the preview width default
is shared between the builder and its loading screen. Adds the
form-builder e2e spec covering page sync.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@SidTGV SidTGV changed the title Tweak - Updated form builder UI Tweak - Form builder UI, survey import/export and add-on extension points Nov 23, 2026
Sid Sharma and others added 2 commits November 23, 2026 17:35
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@SidTGV SidTGV closed this Nov 28, 2026
@SidTGV
SidTGV deleted the ui-rework-sid branch November 28, 2026 04:52
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.

2 participants