Skip to content

Forms: surface common fields first in the block inserter#50425

Open
dhasilva wants to merge 1 commit into
trunkfrom
fix/forms-inserter-priority-order
Open

Forms: surface common fields first in the block inserter#50425
dhasilva wants to merge 1 commit into
trunkfrom
fix/forms-inserter-priority-order

Conversation

@dhasilva

Copy link
Copy Markdown
Contributor

Fixes DSGCOM-690

Proposed changes

When adding a field inside a Form block, the inline "quick inserter" (the + between fields) shows only 6 blocks. That set is driven by the Form block's prioritizedInserterBlocks setting, which overrides Gutenberg's usage-based ("most used"/frecency) ordering for those slots — so the visible fields are fully deterministic, not per-user.

Until now that list was derived from the raw array order in child-blocks.js, which happened to surface incidental fields (Checkbox, Consent, Date, Dropdown, Hidden, Email) and pushed the most commonly used fields — Name (~8th), Text (~11th) — past the 6-item cutoff. They never appeared by default no matter how often a user inserted them.

  • Add an explicit FEATURED_INSERTER_FIELDS order — Name, Email, Text, Textarea, Select (Dropdown), Checkbox — used to build PRIORITIZED_INSERTER_BLOCKS.
  • Remaining valid fields follow after the featured ones in their existing child-blocks.js order, so nothing is removed — only the top 6 change.
  • No behavior change to allowedBlocks or anything else; the constant is only consumed by useInnerBlocksProps for inserter ordering.

Related product discussion/links

  • Linear: DSGCOM-690

Does this pull request change what data or activity we track or use?

No.

Testing instructions

  • Create or edit a post/page and add a Form block.
  • Click the inline + appender inside the form (the quick inserter) — do not type in the search box.
  • Before: the 6 default blocks include Hidden field and omit Name/Text.
  • After: the first 6 are Name, Email, Text, Textarea, Dropdown (Select), Checkbox, in that order.
  • Confirm the order is identical on a brand-new site and on a heavily-used one (it is deterministic and not affected by usage history).
  • Typing in the search box still surfaces every field (e.g. search "hidden" → Hidden field) — only the default ordering changed.

The contact-form block passes prioritizedInserterBlocks to InnerBlocks,
which fully overrides Gutenberg's usage-based ordering in the quick
inserter's 6 visible slots. That order was derived from child-blocks.js
array order, which surfaced incidental fields (Hidden, Consent) while
pushing Name, Email and Text past the 6-item cutoff regardless of how
often they are used.

Define an explicit featured order (Name, Email, Text, Textarea, Select,
Checkbox) and append the remaining valid fields after it.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@dhasilva dhasilva added the [Status] Needs Review This PR is ready for review. label Jul 10, 2026
@dhasilva dhasilva self-assigned this Jul 10, 2026
@github-actions

github-actions Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.

  • To test on WoA, go to the Plugins menu on a WoA dev site. Click on the "Upload" button and follow the upgrade flow to be able to upload, install, and activate the Jetpack Beta plugin. Once the plugin is active, go to Jetpack > Jetpack Beta, select your plugin (Jetpack), and enable the fix/forms-inserter-priority-order branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack fix/forms-inserter-priority-order

Interested in more tips and information?

  • In your local development environment, use the jetpack rsync command to sync your changes to a WoA dev blog.
  • Read more about our development workflow here: PCYsg-eg0-p2
  • Figure out when your changes will be shipped to customers here: PCYsg-eg5-p2

@github-actions

Copy link
Copy Markdown
Contributor

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ✅ Add a "[Status]" label (In Progress, Needs Review, ...).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖


Follow this PR Review Process:

  1. Ensure all required checks appearing at the bottom of this PR are passing.
  2. Make sure to test your changes on all platforms that it applies to. You're responsible for the quality of the code you ship.
  3. You can use GitHub's Reviewers functionality to request a review.
  4. When it's reviewed and merged, you will be pinged in Slack to deploy the changes to WordPress.com simple once the build is done.

If you have questions about anything, reach out in #jetpack-developers for guidance!

@jp-launch-control

Copy link
Copy Markdown

Code Coverage Summary

Coverage changed in 1 file.

File Coverage Δ% Δ Uncovered
projects/packages/forms/src/blocks/contact-form/edit.tsx 0/344 (0.00%) 0.00% 5 💔

Full summary · PHP report · JS report

If appropriate, add one of these labels to override the failing coverage check: Covered by non-unit tests Use to ignore the Code coverage requirement check when E2Es or other non-unit tests cover the code Coverage tests to be added later Use to ignore the Code coverage requirement check when tests will be added in a follow-up PR I don't care about code coverage for this PR Use this label to ignore the check for insufficient code coveage.

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