Skip to content

Feature/post form gutenberg block (recover #1850)#1884

Open
arifulhoque7 wants to merge 6 commits into
weDevsOfficial:developfrom
arifulhoque7:recover/pr-1850
Open

Feature/post form gutenberg block (recover #1850)#1884
arifulhoque7 wants to merge 6 commits into
weDevsOfficial:developfrom
arifulhoque7:recover/pr-1850

Conversation

@arifulhoque7

@arifulhoque7 arifulhoque7 commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Recovered from #1850 (originally by @sapayth), rebased onto develop with merge conflicts resolved. Functionality preserved.

Supersedes #1850.

Summary by CodeRabbit

  • New Features

    • Introduced new Post Form Gutenberg block with template selector and preview rendering.
    • Added five visual form templates: default, dark, colorful, minimal, and bold.
    • Added comprehensive styling controls for form labels, fields, buttons, and help text.
  • Bug Fixes

    • Improved checkbox and radio button layout alignment.
  • Chores

    • Removed legacy Gutenberg block implementation.
    • Updated form asset dependencies.

sapayth and others added 5 commits April 21, 2026 12:36
# Conflicts:
#	assets/css/admin/form-builder.css
#	assets/js/account.min.js
#	assets/js/ai-form-builder.min.js
#	package-lock.json
@coderabbitai

coderabbitai Bot commented Jun 16, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

Replaces the legacy wpuf/form Gutenberg block (iframe-based preview, Form_Gutenberg_Block PHP class) with a new wpuf/post-form block. The new block uses SSR rendering, a Webpack build pipeline with @wordpress/scripts, a rich React editor UI with template presets and styling controls, a PHP PostForm class for registration and sanitized attribute rendering, and a server-side template with scoped CSS generation. Several frontend form layout CSS rules are also refined.

Changes

wpuf/post-form Block Replacement

Layer / File(s) Summary
Old wpuf/form block removal
includes/Admin.php, includes/Frontend/Form_Gutenberg_Block.php, assets/js/admin/gutenblock.js, assets/js/admin/blockFrameSetup.js, assets/css/admin/gutenblock.css
Removes the gutenberg_block container registration, the Form_Gutenberg_Block PHP class (hook wiring, asset enqueueing, iframe preview logic), the old block JS script, the iframe height-adjustment script, and the accompanying admin CSS.
Build tooling
webpack.config.js, package.json
Introduces webpack.config.js extending @wordpress/scripts with a post-form entry and assets/js/blocks output; adds build:blocks/watch:blocks npm scripts and the @wordpress/scripts ^31.8.0 dev dependency.
Block definition, templates, and save contract
src/js/blocks/post-form/block.json, src/js/blocks/post-form/templates.js, src/js/blocks/post-form/save.js, src/js/blocks/post-form/index.js
Declares wpuf/post-form block schema with full attributes and supports, defines five visual template presets with comprehensive styling attributes, registers the SSR-only Save component returning null, and wires the block registration entry point.
Block editor UI
src/js/blocks/post-form/edit.js, src/js/blocks/post-form/editor.css
Implements the Edit component with font-family/block-id utilities, a TemplateCard picker with undo-capable template application via snackbar, InspectorControls for all styling dimensions (label, field, help text, buttons, multistep), and an SSR preview area with debounced updating overlay and custom loading/empty/error placeholders. Adds the editor stylesheet for picker grid, card states, mini-preview, and spinner animation.
PHP block registration and rendering
includes/Blocks/PostForm.php, wpuf.php, includes/Frontend.php
Adds WeDevs\Wpuf\Blocks\PostForm registering the wpuf category, editor assets, and render_callback; implements attribute sanitization (CSS lengths, hex colors, borders, font values) and a wpuf_post_form_block_config filter. Registers the block in the plugin container and extends Frontend::enqueue_scripts() to trigger on has_block('wpuf/post-form').
Server-side block template
includes/templates/blocks/post-form.php
Builds a scoped inline <style> from $block_config for all styling dimensions, applies label-position grid overrides, adds multistep progressbar CSS, and in REST/editor context strips scripts and injects a static progressbar preview (step-by-step or progressive) parsed from shortcode HTML.
Compiled block assets
assets/js/blocks/post-form.js, assets/js/blocks/post-form.css, assets/js/blocks/post-form-rtl.css, assets/js/blocks/post-form.asset.php, assets/js/blocks/js/blocks/post-form/block.json
Webpack-compiled IIFE bundle, LTR and RTL editor stylesheets, updated asset manifest hash, and built block.json mirroring the source definition.
Frontend form CSS refinements
assets/css/frontend-form/layout2.css, assets/css/frontend-form/layout4.css, assets/css/frontend-forms.css, assets/less/frontend-forms.less
Tightens layout2 error/interaction selectors to exclude file/radio/checkbox/submit inputs and specific anchor classes; removes the layout4 file-selector :before glyph; switches checkbox/radio blocks to flex with gap in compiled CSS and LESS source; removes text-shadow from the multistep progress percentage element.

Estimated code review effort

🎯 5 (Critical) | ⏱️ ~120 minutes

Suggested labels

needs: dev review

Suggested reviewers

  • sapayth

Poem

🐇 A bunny hops through Gutenberg lanes,
Old iframes gone, new SSR remains!
Templates bloom in five fresh hues,
Style controls for every muse.
The post form block has found its place —
A scoped <style> with structured grace. ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title accurately describes the main objective: recovering and rebasing a Gutenberg block feature for post forms (PR #1850) onto the develop branch.
Docstring Coverage ✅ Passed Docstring coverage is 85.00% which is sufficient. The required threshold is 80.00%.
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

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.

Guards the get_editor_data() get_posts() query behind is_admin() so it no longer
runs on every front-end request.
@arifulhoque7

Copy link
Copy Markdown
Contributor Author

Review fix pushed: register_block() localized get_editor_data() (a get_posts( numberposts => -1 ) over all forms) on every request, though it's only needed in the editor. Now guarded behind is_admin(). The extract() in render() is the standard template-include pattern (phpcs-ignored) — left as-is; block output was verified escaped.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 5

🤖 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 `@includes/Blocks/PostForm.php`:
- Around line 117-119: The get_post_meta() call retrieving wpuf_form_settings
meta may return a non-array value, causing runtime warnings/errors when
accessing the enable_multistep array offset. In includes/Blocks/PostForm.php
(lines 117-119), normalize the $settings variable to guarantee it's an array
before accessing its offsets—use a method like casting to array or checking with
is_array(). Apply the same normalization fix in
includes/templates/blocks/post-form.php around line 213 onward where the
identical wpuf_form_settings meta retrieval and array-offset access occurs, to
prevent the same issue across both code paths.
- Line 350: Replace the `sanitize_text_field()` call for the `labelFontWeight`
attribute with a font-weight allowlist sanitizer that constrains the value to
known valid CSS font-weight values (such as normal, bold, or numeric values
100-900). This ensures consistency with sanitization patterns used for other
font-related fields and prevents malformed CSS values from being passed through.

In `@src/js/blocks/post-form/block.json`:
- Around line 12-82: The block schema in src/js/blocks/post-form/block.json
(lines 12-82) is missing errorMessageColor and successMessageColor attributes
that are already defined in the templates and PHP, which causes WordPress to
potentially filter or reject these attributes during block validation. Add two
new attributes to the attributes object in block.json after msInactiveBgColor:
errorMessageColor with type string and default empty string, and
successMessageColor with type string and default empty string. In
src/js/blocks/post-form/templates.js (lines 4-347), no change is needed as the
templates already correctly define these attributes; once the block.json schema
is updated, the templates will align properly with the schema.

In `@src/js/blocks/post-form/edit.js`:
- Around line 259-271: The loading overlay state gets set to true by the
attribute change handler in the useEffect hook but relies on cleanup at the
loading placeholder to reset it, which may not execute on fast responses. To fix
this, tie the isUpdating state directly to the API request lifecycle instead of
attribute changes. Find where the API request is initiated (likely after
setIsUpdating is called in the timeout) and ensure setIsUpdating is set to false
when the response completes or fails. This may involve capturing the loading
promise or request completion, and explicitly resetting isUpdating in the
response handler or catch block, rather than depending on the loading
placeholder cleanup mechanism.

In `@src/js/blocks/post-form/editor.css`:
- Around line 13-16: The CSS rules targeting .components-base-control
span.components-base-control__label and .components-base-control label in the
editor.css file are unscoped and leak margin styles globally across the block
editor. Wrap these selectors with the block wrapper scope (for example,
.wp-block-wpuf-post-form) to ensure the margin-top override only applies within
the post-form block context. After making this change, regenerate the compiled
CSS files in the assets/js/blocks/ directory by running your build process to
update post-form.css and post-form-rtl.css.
🪄 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: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 25d0fa74-adcb-415d-a248-6f2792a2b806

📥 Commits

Reviewing files that changed from the base of the PR and between 9a241d2 and d831659.

⛔ Files ignored due to path filters (2)
  • assets/js/blocks/post-form.css.map is excluded by !**/*.map
  • assets/js/blocks/post-form.js.map is excluded by !**/*.map
📒 Files selected for processing (28)
  • assets/css/admin/gutenblock-editor.css
  • assets/css/admin/gutenblock.css
  • assets/css/frontend-form/layout2.css
  • assets/css/frontend-form/layout4.css
  • assets/css/frontend-forms.css
  • assets/js/admin/blockFrameSetup.js
  • assets/js/admin/gutenblock.js
  • assets/js/blocks/js/blocks/post-form/block.json
  • assets/js/blocks/post-form-rtl.css
  • assets/js/blocks/post-form.asset.php
  • assets/js/blocks/post-form.css
  • assets/js/blocks/post-form.js
  • assets/less/frontend-forms.less
  • includes/Admin.php
  • includes/Blocks/PostForm.php
  • includes/Frontend.php
  • includes/Frontend/Form_Gutenberg_Block.php
  • includes/Integrations/Events_Calendar/Compatibility/TEC_V6_Compatibility.php
  • includes/templates/blocks/post-form.php
  • package.json
  • src/js/blocks/post-form/block.json
  • src/js/blocks/post-form/edit.js
  • src/js/blocks/post-form/editor.css
  • src/js/blocks/post-form/index.js
  • src/js/blocks/post-form/save.js
  • src/js/blocks/post-form/templates.js
  • webpack.config.js
  • wpuf.php
💤 Files with no reviewable changes (7)
  • assets/css/admin/gutenblock.css
  • assets/js/admin/blockFrameSetup.js
  • assets/js/admin/gutenblock.js
  • includes/Admin.php
  • includes/Frontend/Form_Gutenberg_Block.php
  • assets/css/frontend-form/layout4.css
  • includes/Integrations/Events_Calendar/Compatibility/TEC_V6_Compatibility.php

Comment on lines +117 to +119
$settings = get_post_meta( $form->ID, 'wpuf_form_settings', true );
$is_multistep = ! empty( $settings['enable_multistep'] ) && in_array( $settings['enable_multistep'], [ 'on', 'yes' ], true );

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 | 🟠 Major | ⚡ Quick win

Normalize wpuf_form_settings before array-offset access.

Line 118 assumes get_post_meta( ..., true ) always returns an array. If it returns a non-array value, multistep detection can emit runtime warnings/errors and break editor rendering paths. Apply the same normalization where this meta is read in includes/templates/blocks/post-form.php (Line 213 onward), since it shares the same assumption.

Suggested fix
-            $settings     = get_post_meta( $form->ID, 'wpuf_form_settings', true );
-            $is_multistep = ! empty( $settings['enable_multistep'] ) && in_array( $settings['enable_multistep'], [ 'on', 'yes' ], true );
+            $settings     = get_post_meta( $form->ID, 'wpuf_form_settings', true );
+            $settings     = is_array( $settings ) ? $settings : [];
+            $is_multistep = ! empty( $settings['enable_multistep'] ) && in_array( $settings['enable_multistep'], [ 'on', 'yes' ], true );
🤖 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 `@includes/Blocks/PostForm.php` around lines 117 - 119, The get_post_meta()
call retrieving wpuf_form_settings meta may return a non-array value, causing
runtime warnings/errors when accessing the enable_multistep array offset. In
includes/Blocks/PostForm.php (lines 117-119), normalize the $settings variable
to guarantee it's an array before accessing its offsets—use a method like
casting to array or checking with is_array(). Apply the same normalization fix
in includes/templates/blocks/post-form.php around line 213 onward where the
identical wpuf_form_settings meta retrieval and array-offset access occurs, to
prevent the same issue across both code paths.

$block_config = [
'label_font_size' => $this->sanitize_css_length( $attributes['labelFontSize'] ),
'label_color' => sanitize_hex_color( $attributes['labelColor'] ) ?? '',
'label_font_weight' => sanitize_text_field( $attributes['labelFontWeight'] ),

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

Use the font-weight allowlist sanitizer for labelFontWeight.

Line 350 uses sanitize_text_field() for a CSS token that should be constrained to known valid values. This weakens sanitization consistency versus the rest of the font-related fields and can produce malformed CSS values.

Suggested fix
-            'label_font_weight'           => sanitize_text_field( $attributes['labelFontWeight'] ),
+            'label_font_weight'           => $this->sanitize_font_weight( $attributes['labelFontWeight'] ),
🤖 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 `@includes/Blocks/PostForm.php` at line 350, Replace the
`sanitize_text_field()` call for the `labelFontWeight` attribute with a
font-weight allowlist sanitizer that constrains the value to known valid CSS
font-weight values (such as normal, bold, or numeric values 100-900). This
ensures consistency with sanitization patterns used for other font-related
fields and prevents malformed CSS values from being passed through.

Comment on lines +12 to +82
"attributes": {
"blockId": { "type": "string", "default": "" },
"formId": { "type": "number", "default": 0 },
"activeTemplate": { "type": "string", "default": "default" },
"labelPosition": { "type": "string", "default": "above" },
"labelFontSize": { "type": "string", "default": "14px" },
"labelColor": { "type": "string", "default": "" },
"labelFontWeight": { "type": "string", "default": "normal" },
"labelFontFamily": { "type": "string", "default": "" },
"labelFontStyle": { "type": "string", "default": "" },
"helpTextColor": { "type": "string", "default": "" },
"helpTextFontFamily": { "type": "string", "default": "" },
"helpTextFontSize": { "type": "string", "default": "12px" },
"helpTextFontStyle": { "type": "string", "default": "" },
"helpTextFontWeight": { "type": "string", "default": "" },
"fieldBorder": {
"type": "object",
"default": {
"color": "#dddddd",
"style": "solid",
"width": "1px"
}
},
"fieldBorderRadius": { "type": "string", "default": "4px" },
"fieldPaddingV": { "type": "string", "default": "8px" },
"fieldPaddingH": { "type": "string", "default": "12px" },
"fieldBackgroundColor": { "type": "string", "default": "" },
"fieldTextColor": { "type": "string", "default": "" },
"fieldPlaceholderColor": { "type": "string", "default": "" },
"fieldFontFamily": { "type": "string", "default": "" },
"fieldFontSize": { "type": "string", "default": "14px" },
"fieldFontStyle": { "type": "string", "default": "" },
"fieldFontWeight": { "type": "string", "default": "" },
"fieldMarginBottom": { "type": "string", "default": "16px" },
"fieldFocusBorderColor": { "type": "string", "default": "" },
"buttonBackgroundColor": { "type": "string", "default": "" },
"buttonTextColor": { "type": "string", "default": "" },
"buttonFontFamily": { "type": "string", "default": "" },
"buttonFontStyle": { "type": "string", "default": "" },
"buttonFontWeight": { "type": "string", "default": "" },
"buttonBorderWidth": { "type": "string", "default": "0px" },
"buttonBorderRadius": { "type": "string", "default": "4px" },
"buttonFontSize": { "type": "string", "default": "14px" },
"buttonPaddingV": { "type": "string", "default": "10px" },
"buttonPaddingH": { "type": "string", "default": "20px" },
"uploadButtonBackgroundColor": { "type": "string", "default": "" },
"uploadButtonTextColor": { "type": "string", "default": "" },
"uploadButtonFontFamily": { "type": "string", "default": "" },
"uploadButtonFontStyle": { "type": "string", "default": "" },
"uploadButtonFontWeight": { "type": "string", "default": "" },
"uploadButtonBorderColor": { "type": "string", "default": "#dddddd" },
"uploadButtonBorderWidth": { "type": "string", "default": "1px" },
"uploadButtonBorderRadius": { "type": "string", "default": "4px" },
"uploadButtonFontSize": { "type": "string", "default": "13px" },
"uploadButtonPaddingV": { "type": "string", "default": "8px" },
"uploadButtonPaddingH": { "type": "string", "default": "16px" },
"msButtonBackgroundColor": { "type": "string", "default": "#1e1e1e" },
"msButtonTextColor": { "type": "string", "default": "#ffffff" },
"msButtonFontFamily": { "type": "string", "default": "" },
"msButtonFontStyle": { "type": "string", "default": "" },
"msButtonFontWeight": { "type": "string", "default": "" },
"msButtonBorderColor": { "type": "string", "default": "" },
"msButtonBorderWidth": { "type": "string", "default": "0px" },
"msButtonBorderRadius": { "type": "string", "default": "4px" },
"msButtonFontSize": { "type": "string", "default": "14px" },
"msButtonPaddingV": { "type": "string", "default": "10px" },
"msButtonPaddingH": { "type": "string", "default": "20px" },
"msActiveBgColor": { "type": "string", "default": "" },
"msActiveTextColor": { "type": "string", "default": "" },
"msInactiveBgColor": { "type": "string", "default": "" }
},

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 | 🔴 Critical | ⚡ Quick win

Block schema is missing two styling attributes defined in templates and PHP.

The root cause: block.json does not include errorMessageColor and successMessageColor in the attributes section, but templates.js defines these in every template preset (e.g., line 69–70 of default template) and PostForm::render() in PHP includes them in defaults. Without schema definition, WordPress may filter or reject these attributes during block save/validation, breaking error/success message styling.

  • src/js/blocks/post-form/block.json#L12-L82: Add errorMessageColor and successMessageColor to the attributes object before the closing } at line 82. Add these two lines after msInactiveTextColor:
    "errorMessageColor": { "type": "string", "default": "" },
    "successMessageColor": { "type": "string", "default": "" },
  • src/js/blocks/post-form/templates.js#L4-L347: No change needed in this file; the templates correctly define these attributes. Once block.json is updated, the templates will align with the schema.
📍 Affects 2 files
  • src/js/blocks/post-form/block.json#L12-L82 (this comment)
  • src/js/blocks/post-form/templates.js#L4-L347
🤖 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 `@src/js/blocks/post-form/block.json` around lines 12 - 82, The block schema in
src/js/blocks/post-form/block.json (lines 12-82) is missing errorMessageColor
and successMessageColor attributes that are already defined in the templates and
PHP, which causes WordPress to potentially filter or reject these attributes
during block validation. Add two new attributes to the attributes object in
block.json after msInactiveBgColor: errorMessageColor with type string and
default empty string, and successMessageColor with type string and default empty
string. In src/js/blocks/post-form/templates.js (lines 4-347), no change is
needed as the templates already correctly define these attributes; once the
block.json schema is updated, the templates will align properly with the schema.

Comment on lines +259 to +271
useEffect(() => {
if (isFirstRender.current) {
isFirstRender.current = false;
return;
}
if (debounceTimerRef.current) {
clearTimeout(debounceTimerRef.current);
}
debounceTimerRef.current = setTimeout(() => {
setIsUpdating(true);
}, 150);
return () => clearTimeout(debounceTimerRef.current);
}, [attributes]);

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 | 🟠 Major | ⚡ Quick win

Loading overlay state can get stuck after fast SSR responses

Line 267 sets isUpdating from an attribute-change timer, but reset happens only via the loading placeholder cleanup at Lines 807-811. When a response resolves quickly, that cleanup path may not run, leaving the overlay permanently visible.

Suggested fix (tie overlay state to loading lifecycle instead of raw attribute changes)
-    // SSR loading overlay state
-    const [isUpdating, setIsUpdating] = useState(false);
-    const debounceTimerRef = useRef(null);
-    const isFirstRender = useRef(true);
-
-    useEffect(() => {
-        if (isFirstRender.current) {
-            isFirstRender.current = false;
-            return;
-        }
-        if (debounceTimerRef.current) {
-            clearTimeout(debounceTimerRef.current);
-        }
-        debounceTimerRef.current = setTimeout(() => {
-            setIsUpdating(true);
-        }, 150);
-        return () => clearTimeout(debounceTimerRef.current);
-    }, [attributes]);
+    // SSR loading overlay state
+    const [isUpdating, setIsUpdating] = useState(false);
-                            LoadingResponsePlaceholder={() => {
-                                // eslint-disable-next-line react-hooks/rules-of-hooks
-                                useEffect(() => {
-                                    return () => {
-                                        setIsUpdating(false);
-                                    };
-                                }, []);
-                                return null;
-                            }}
+                            LoadingResponsePlaceholder={() => {
+                                // eslint-disable-next-line react-hooks/rules-of-hooks
+                                useEffect(() => {
+                                    const timer = setTimeout(() => setIsUpdating(true), 150);
+                                    return () => {
+                                        clearTimeout(timer);
+                                        setIsUpdating(false);
+                                    };
+                                }, []);
+                                return null;
+                            }}

Also applies to: 805-813

🤖 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 `@src/js/blocks/post-form/edit.js` around lines 259 - 271, The loading overlay
state gets set to true by the attribute change handler in the useEffect hook but
relies on cleanup at the loading placeholder to reset it, which may not execute
on fast responses. To fix this, tie the isUpdating state directly to the API
request lifecycle instead of attribute changes. Find where the API request is
initiated (likely after setIsUpdating is called in the timeout) and ensure
setIsUpdating is set to false when the response completes or fails. This may
involve capturing the loading promise or request completion, and explicitly
resetting isUpdating in the response handler or catch block, rather than
depending on the loading placeholder cleanup mechanism.

Comment on lines +13 to +16
.components-base-control span.components-base-control__label,
.components-base-control label {
margin-top: .5rem;
}

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 | 🟠 Major | ⚡ Quick win

Unscoped selector leaks styles across the entire block editor

Lines 13-16 target .components-base-control globally, so this margin override can affect controls outside wpuf/post-form. Scope this rule to the block wrapper (for example, .wp-block-wpuf-post-form ...) and regenerate assets/js/blocks/post-form.css plus assets/js/blocks/post-form-rtl.css.

🤖 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 `@src/js/blocks/post-form/editor.css` around lines 13 - 16, The CSS rules
targeting .components-base-control span.components-base-control__label and
.components-base-control label in the editor.css file are unscoped and leak
margin styles globally across the block editor. Wrap these selectors with the
block wrapper scope (for example, .wp-block-wpuf-post-form) to ensure the
margin-top override only applies within the post-form block context. After
making this change, regenerate the compiled CSS files in the assets/js/blocks/
directory by running your build process to update post-form.css and
post-form-rtl.css.

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.

2 participants