Skip to content

fix: adjust form item margin styles in global and properties tabs#4588

Merged
James-Baloyi merged 1 commit intoshesha-io:mainfrom
czwe-01:thulasizwe/bug/3557
Mar 11, 2026
Merged

fix: adjust form item margin styles in global and properties tabs#4588
James-Baloyi merged 1 commit intoshesha-io:mainfrom
czwe-01:thulasizwe/bug/3557

Conversation

@czwe-01
Copy link
Copy Markdown
Collaborator

@czwe-01 czwe-01 commented Mar 11, 2026

#3557
Fixed issue with margins applied through jsStyles were overidden in preview mode.

Summary by CodeRabbit

  • Style
    • Adjusted form item margin styling to optimize spacing and alignment of form fields throughout the application, improving overall layout consistency.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 11, 2026

Walkthrough

The changes relocate a form-item margin reset from the main layout global styles to the properties tabs component styles. The margin reset (set to 0 !important) is removed from one file and added to another, effectively changing which component scope applies this styling rule to form items.

Changes

Cohort / File(s) Summary
Main Layout Styles
shesha-reactjs/src/components/mainLayout/styles/indexStyles.ts
Removed explicit margin: 0 !important; declaration for .${(p) => p.theme.prefixCls}-form-item, allowing default or inherited margins to apply.
Properties Tabs Styles
shesha-reactjs/src/designer-components/propertiesTabs/style.ts
Added global style override setting .ant-form-item margin to 0 with !important within the component's content styles.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

Suggested reviewers

  • James-Baloyi
  • IvanIlyichev

Poem

🐰 A margin migrates from layout to tabs,
Form items align with CSS maps,
Zero declarations, important and neat,
Spacing shifts to keep rhythm complete!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 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 change: adjusting form item margin styles across two files to fix margin override issues in preview mode.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

@czwe-01 czwe-01 requested a review from James-Baloyi March 11, 2026 07:55
Copy link
Copy Markdown
Contributor

@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

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@shesha-reactjs/src/designer-components/propertiesTabs/style.ts`:
- Around line 36-38: The global reset targeting `.ant-form-item` is too broad;
narrow it to only the JS-style preview wrapper by changing the selector to scope
under the preview root (e.g., target `.sha-js-label .ant-form-item` or the
`ConfigurableFormItem` root like `.ConfigurableFormItem .ant-form-item`) so only
preview rows lose the margin without affecting `SettingsFormItem` or other
Form.Item instances in the properties panel.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: ba767d58-f1a4-4238-83c5-178412ae25d0

📥 Commits

Reviewing files that changed from the base of the PR and between 4479a26 and 513448c.

📒 Files selected for processing (2)
  • shesha-reactjs/src/components/mainLayout/styles/indexStyles.ts
  • shesha-reactjs/src/designer-components/propertiesTabs/style.ts
💤 Files with no reviewable changes (1)
  • shesha-reactjs/src/components/mainLayout/styles/indexStyles.ts

Comment on lines +36 to +38
.ant-form-item {
margin: 0px !important;
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Scope this margin reset to the js-style preview wrapper only.

Line 36 now matches every Ant Form.Item in the properties tabs. SettingsFormItem renders regular settings controls as plain Form.Items, so this removes the default vertical spacing for the whole panel, not just the preview rows this fix is targeting. Please narrow the selector to the preview-specific wrapper (.sha-js-label / the ConfigurableFormItem root) instead of all .ant-form-items.

Example of a safer scope
-    .ant-form-item {
-      margin: 0px !important;
-    }
+    .sha-js-label,
+    .sha-js-label .ant-form-item {
+      margin: 0 !important;
+    }

Based on learnings: "dimension and margin handling follows a wrapper-based pattern: the FormItem wrapper (ConfigurableFormItem) is responsible for applying dimensions, margins, and layout styles..."

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
.ant-form-item {
margin: 0px !important;
}
.sha-js-label,
.sha-js-label .ant-form-item {
margin: 0 !important;
}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@shesha-reactjs/src/designer-components/propertiesTabs/style.ts` around lines
36 - 38, The global reset targeting `.ant-form-item` is too broad; narrow it to
only the JS-style preview wrapper by changing the selector to scope under the
preview root (e.g., target `.sha-js-label .ant-form-item` or the
`ConfigurableFormItem` root like `.ConfigurableFormItem .ant-form-item`) so only
preview rows lose the margin without affecting `SettingsFormItem` or other
Form.Item instances in the properties panel.

@James-Baloyi James-Baloyi merged commit 9477a08 into shesha-io:main Mar 11, 2026
2 checks passed
@czwe-01 czwe-01 deleted the thulasizwe/bug/3557 branch March 16, 2026 12:02
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