Forms: surface common fields first in the block inserter#50425
Conversation
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]>
|
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
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:
If you have questions about anything, reach out in #jetpack-developers for guidance! |
Code Coverage SummaryCoverage changed in 1 file.
Full summary · PHP report · JS report If appropriate, add one of these labels to override the failing coverage check:
Covered by non-unit tests
|
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'sprioritizedInserterBlockssetting, 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.FEATURED_INSERTER_FIELDSorder — Name, Email, Text, Textarea, Select (Dropdown), Checkbox — used to buildPRIORITIZED_INSERTER_BLOCKS.child-blocks.jsorder, so nothing is removed — only the top 6 change.allowedBlocksor anything else; the constant is only consumed byuseInnerBlocksPropsfor inserter ordering.Related product discussion/links
Does this pull request change what data or activity we track or use?
No.
Testing instructions
+appender inside the form (the quick inserter) — do not type in the search box.