Skip to content

fix(builder): replace live field previews in Add Fields palette#135

Merged
harshtandiya merged 6 commits into
developfrom
fix/add-fields-preview-autofill
May 16, 2026
Merged

fix(builder): replace live field previews in Add Fields palette#135
harshtandiya merged 6 commits into
developfrom
fix/add-fields-preview-autofill

Conversation

@harshtandiya
Copy link
Copy Markdown
Collaborator

@harshtandiya harshtandiya commented May 15, 2026

Summary

  • Add Fields palette mounted live RenderField instances, so browser autofill chips appeared on Email/Phone/Password palette tiles (bad UX, palette is not a real form).
  • Replaced live previews with a static icon + label button per fieldtype. Each entry in FIELD_TYPE_DEFINITIONS now carries a lucide icon. Whole tile is now the click target.
  • Updated e2e/helpers/form-builder.ts:addField for the new structure (palette item is a <button> directly).
Before After
image image

Test plan

  • yarn typecheck clean
  • npx playwright test add-fields-palette form-creation form-layout — 16/16 green
  • Manual: open builder, confirm no autofill suggestions on Email/Phone tiles, search filters palette, click adds field

Summary by CodeRabbit

Release Notes

  • New Features

    • Field type buttons in the Add Fields palette now show icons and use a simplified, full-width button layout.
    • Search now filters fields by name for more accurate results.
  • Bug Fixes

    • Removed live input previews inside palette items to prevent unwanted browser autofill.
  • Tests

    • Added end-to-end tests covering palette rendering, search filtering, and adding fields to the canvas.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 15, 2026

Warning

Rate limit exceeded

@harshtandiya has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 35 minutes and 25 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 73cdc5b6-4cf2-43a4-8d31-c62b64bc8b74

📥 Commits

Reviewing files that changed from the base of the PR and between e0975e4 and f4375ed.

📒 Files selected for processing (2)
  • frontend/src/components/FormBuilderSidebar.vue
  • frontend/src/components/builder/sidebar/AddFieldsSection.vue
📝 Walkthrough

Walkthrough

Field types are extended with Lucide icon components, the Add Fields sidebar is refactored to render filterable field buttons with icons (no live input previews), and E2E tests plus a helper selector were added/updated to validate and interact with the new palette UI.

Changes

Add Fields Palette Icons and Filtering

Layer / File(s) Summary
Field type icons configuration
frontend/src/config/fieldTypes.ts
Lucide Vue icon components are imported. FieldTypeDefinition is extended with a required icon: Component property. FIELD_TYPE_DEFINITIONS entries are populated with the corresponding icon for each field type.
Add Fields sidebar component refactor
frontend/src/components/builder/sidebar/AddFieldsSection.vue
Replaces the component-preview flow with a filteredFields computed that filters formFields by lowercased search. Template now shows a “No fields match” message when empty; otherwise renders a full-width button per field showing field.icon and field.name and calls editFormStore.addField(field.name) on click.
E2E test coverage and helper update
frontend/e2e/helpers/form-builder.ts, frontend/e2e/specs/add-fields-palette.spec.ts
FormBuilderPage.addField() now clicks the sidebar button by accessible name (scoped to the sidebar). Adds a Playwright suite that asserts palette buttons render without live input previews, search filtering behavior, and that clicking a palette item adds the field to the canvas.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested labels

backport/version-15

Poem

🐰 I hopped through icons, bright and neat,
Buttons now sparkle—no autofill cheat.
Search snaps tight, previews are gone,
Click and the canvas sings at dawn.
Tests nibble crumbs to show it's done. 🥕

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: replacing live field previews with static buttons in the Add Fields palette to fix the autofill UX issue.
Description check ✅ Passed The PR description covers the Summary section well with clear problem and solution, provides a test plan with specific test commands and manual steps, but omits the Checklist section from the template.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/add-fields-preview-autofill

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 and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
frontend/e2e/specs/add-fields-palette.spec.ts (1)

28-41: ⚡ Quick win

Consider testing Password button as well.

The test validates that Email and Phone buttons contain no autofillable inputs. Since Password fields also trigger browser autofill (mentioned in PR objectives), consider adding:

const passwordBtn = sidebar.getByRole("button", {
  name: "Password",
  exact: true,
});
await expect(passwordBtn.locator("input")).toHaveCount(0);
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@frontend/e2e/specs/add-fields-palette.spec.ts` around lines 28 - 41, The test
currently asserts no autofillable inputs for Email and Phone buttons (using
sidebar.getByRole and locators emailBtn and phoneBtn) but misses the Password
case; add a similar assertion for the Password palette button by locating it via
sidebar.getByRole({ name: "Password", exact: true }) (e.g., passwordBtn) and
assert passwordBtn.locator("input") has count 0 so Password buttons are covered
just like Email and Phone.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@frontend/e2e/specs/add-fields-palette.spec.ts`:
- Around line 60-72: Add missing assertions verifying that "Date Time" and "Date
Range" remain visible after filtering; locate the block where the test fills the
search input via sidebar.getByPlaceholder("Search Fields").fill("date") and
currently only asserts sidebar.getByRole("button", { name: "Date", exact: true
}).toBeVisible(), then add two additional expectations using
sidebar.getByRole("button", { name: "Date Time", exact: true }) and
sidebar.getByRole("button", { name: "Date Range", exact: true }) and assert they
are visible so all three date-related buttons are covered.

---

Nitpick comments:
In `@frontend/e2e/specs/add-fields-palette.spec.ts`:
- Around line 28-41: The test currently asserts no autofillable inputs for Email
and Phone buttons (using sidebar.getByRole and locators emailBtn and phoneBtn)
but misses the Password case; add a similar assertion for the Password palette
button by locating it via sidebar.getByRole({ name: "Password", exact: true })
(e.g., passwordBtn) and assert passwordBtn.locator("input") has count 0 so
Password buttons are covered just like Email and Phone.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 922368a4-5f43-42cd-a294-36d05265565f

📥 Commits

Reviewing files that changed from the base of the PR and between ebb73e6 and 2745f62.

📒 Files selected for processing (4)
  • frontend/e2e/helpers/form-builder.ts
  • frontend/e2e/specs/add-fields-palette.spec.ts
  • frontend/src/components/builder/sidebar/AddFieldsSection.vue
  • frontend/src/config/fieldTypes.ts

Comment on lines +60 to +72
await sidebar.getByPlaceholder("Search Fields").fill("date");

// "Date", "Date Time", "Date Range" remain (case-insensitive substring)
await expect(
sidebar.getByRole("button", { name: "Date", exact: true })
).toBeVisible();
// Unrelated types are filtered out
await expect(
sidebar.getByRole("button", { name: "Phone", exact: true })
).toHaveCount(0);
await expect(
sidebar.getByRole("button", { name: "Data", exact: true })
).toHaveCount(0);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Add assertions for Date Time and Date Range.

The comment on line 62 states that "Date", "Date Time", and "Date Range" should remain after filtering for "date", but only the "Date" button is verified. Add:

await expect(
  sidebar.getByRole("button", { name: "Date Time", exact: true })
).toBeVisible();
await expect(
  sidebar.getByRole("button", { name: "Date Range", exact: true })
).toBeVisible();

This ensures the filter correctly matches all date-related field types.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@frontend/e2e/specs/add-fields-palette.spec.ts` around lines 60 - 72, Add
missing assertions verifying that "Date Time" and "Date Range" remain visible
after filtering; locate the block where the test fills the search input via
sidebar.getByPlaceholder("Search Fields").fill("date") and currently only
asserts sidebar.getByRole("button", { name: "Date", exact: true
}).toBeVisible(), then add two additional expectations using
sidebar.getByRole("button", { name: "Date Time", exact: true }) and
sidebar.getByRole("button", { name: "Date Range", exact: true }) and assert they
are visible so all three date-related buttons are covered.

…alette buttons

- transition-colors → transition-all so active:scale-[0.98] animates
- remove constant-text Tooltip wrapper (icon + label already convey action)
- drop redundant `as Fieldtype` cast and unused Fieldtype import
- type-only import for FormFields
- tablist semantics on rail (role=tablist/tab/tabpanel, aria-selected, aria-controls)
- aria-label on icon-only tab buttons (SR-accessible)
- left accent bar on active tab for stronger emphasis (bg-surface-gray-7)
- section-fade transition (120ms ease-out enter, ease-in leave) on content panel
- respect prefers-reduced-motion
- 100vh → 100dvh on sidebar height (mobile-safe)
- swap to frappe-ui semantic tokens: bg-surface-gray-{1,2,3}, bg-surface-white, border-outline-gray-{1,2}
- default active section via id lookup, sidebarSections const (never mutated)
@harshtandiya harshtandiya enabled auto-merge May 16, 2026 06:38
@harshtandiya harshtandiya added this pull request to the merge queue May 16, 2026
Merged via the queue into develop with commit 8d43df9 May 16, 2026
7 checks passed
@harshtandiya harshtandiya deleted the fix/add-fields-preview-autofill branch May 16, 2026 06:46
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.

1 participant