Skip to content

Conversation

@ArgoZhang
Copy link
Member

@ArgoZhang ArgoZhang commented Feb 1, 2026

Link issues

fixes #7611

Summary By Copilot

Regression?

  • Yes
  • No

Risk

  • High
  • Medium
  • Low

Verification

  • Manual (required)
  • Automated

Packaging changes reviewed?

  • Yes
  • No
  • N/A

☑️ Self Check before Merge

⚠️ Please check all items below before review. ⚠️

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • Merge the latest code from the main branch

Summary by Sourcery

Add configurable grouping layout for EditorForm and demonstrate its usage.

New Features:

  • Introduce the EditorFormGroupType enum to control EditorForm grouping layout (GroupBox vs RowHeader).
  • Expose a GroupType parameter on EditorForm to switch between grouping styles.
  • Add a sample EditorForm demo allowing users to toggle the grouping style at runtime.

Enhancements:

  • Extend EditorForm styling to support a row-header group layout with vertical group titles and dividers.
  • Adjust GroupBox markup to use a span for the legend title to better support the new layout.

Tests:

  • Add a unit test verifying that EditorForm renders the correct CSS class for each GroupType value.

Copilot AI review requested due to automatic review settings February 1, 2026 01:50
@bb-auto bb-auto bot added the enhancement New feature or request label Feb 1, 2026
@bb-auto bb-auto bot added this to the v10.3.0 milestone Feb 1, 2026
@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Feb 1, 2026

Reviewer's Guide

Adds selectable group layout support to EditorForm so it can render traditional GroupBox or new row-header styling, updates samples and styles to showcase it, and covers the behavior with unit tests and localization keys.

Sequence diagram for switching EditorForm group layout

sequenceDiagram
    actor User
    participant Browser
    participant EditorForms
    participant EditorForm_TModel_ as EditorForm<TModel>

    User->>Browser: Click Segmented item (GroupBox or RowHeader)
    Browser->>EditorForms: Trigger change event with selected EditorFormGroupType
    EditorForms->>EditorForms: Update _groupType
    EditorForms->>EditorForm_TModel_: Render EditorForm GroupType=_groupType
    EditorForm_TModel_->>EditorForm_TModel_: Build ClassString
    EditorForm_TModel_->>Browser: Render with .bb-editor-group-row-header when GroupType==RowHeader
    Browser->>User: Display grouped fields in selected layout
Loading

Class diagram for new EditorFormGroupType integration

classDiagram
    direction LR

    class EditorFormGroupType {
        <<enumeration>>
        GroupBox
        RowHeader
    }

    class EditorForm_TModel_ {
        +EditorFormGroupType GroupType
        -string ClassString
    }

    class EditorForms {
        -EditorFormGroupType _groupType
    }

    EditorForm_TModel_ ..> EditorFormGroupType : uses
    EditorForms ..> EditorFormGroupType : uses
    EditorForms ..> EditorForm_TModel_ : provides_GroupType

    class GroupBox {
        +object? AdditionalAttributes
        +string ClassString
        +object? ChildContent
        +string? Title
    }

    class EditorFormStyles {
        <<stylesheet>>
        +.bb-editor
        +.bb-editor-group-row-header
    }

    EditorForm_TModel_ ..> EditorFormStyles : mapped_by_ClassString
    GroupBox ..> EditorFormStyles : uses_legend_class
Loading

File-Level Changes

Change Details Files
Introduced GroupType parameter on EditorForm to toggle new row-header grouping layout.
  • Extended CSS builder to append bb-editor-group-row-header when GroupType is RowHeader.
  • Added [Parameter] property GroupType with default GroupBox semantics.
  • Created EditorFormGroupType enum describing GroupBox vs RowHeader modes.
  • Styled .bb-editor-row-header skin with flex layout and vertical legends.
  • Updated GroupBox markup to use span legend for compatibility.
src/BootstrapBlazor/Components/EditorForm/EditorForm.razor.cs
src/BootstrapBlazor/Enums/EditorFormGroupType.cs
src/BootstrapBlazor/Components/EditorForm/EditorForm.razor.scss
src/BootstrapBlazor/Components/GroupBox/GroupBox.razor
Demonstrated and localized the new grouping option in sample apps.
  • Added demo block with Segmented control bound to new _groupType backing field and passed to EditorForm.
  • Initialized _groupType in sample code-behind and wired introductions via new localized strings.
  • Extended en-US and zh-CN locale files with GroupTitle/Intro/Description entries.
src/BootstrapBlazor.Server/Components/Samples/EditorForms.razor
src/BootstrapBlazor.Server/Components/Samples/EditorForms.razor.cs
src/BootstrapBlazor.Server/Locales/en-US.json
src/BootstrapBlazor.Server/Locales/zh-CN.json
Covered GroupType behavior in tests.
  • Added unit test ensuring bb-editor-group-row-header class toggles when GroupType switches from GroupBox to RowHeader.
test/UnitTest/Components/EditorFormTest.cs
Adjusted project file to include the new enum source.
  • Added EditorFormGroupType.cs to BootstrapBlazor.csproj compile items.
src/BootstrapBlazor/BootstrapBlazor.csproj

Assessment against linked issues

Issue Objective Addressed Explanation
#7611 Add an EditorFormGroupType parameter to the EditorForm component, including defining the EditorFormGroupType enum and wiring it into the component’s behavior.
#7611 Update usage sites (samples/tests/styles) to support and demonstrate the new EditorFormGroupType parameter.

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@ArgoZhang ArgoZhang merged commit c98250e into main Feb 1, 2026
8 checks passed
@ArgoZhang ArgoZhang deleted the dev-group branch February 1, 2026 01:51
@codecov
Copy link

codecov bot commented Feb 1, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (66ec4ce) to head (8111054).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #7612   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          749       749           
  Lines        33005     33007    +2     
  Branches      4580      4580           
=========================================
+ Hits         33005     33007    +2     
Flag Coverage Δ
BB 100.00% <100.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds a GroupType parameter to the EditorForm component, allowing developers to choose between two display styles for grouped form items: GroupBox (default) and RowHeader. The RowHeader style displays groups with a vertical header orientation and a vertical divider line.

Changes:

  • Added new EditorFormGroupType enum with GroupBox and RowHeader options
  • Added GroupType parameter to EditorForm component to control group display style
  • Changed GroupBox component's legend element from <label> to <span> for better semantic HTML
  • Added SCSS styling for the RowHeader display mode

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/BootstrapBlazor/Enums/EditorFormGroupType.cs New enum defining the two group display types (GroupBox and RowHeader)
src/BootstrapBlazor/Components/EditorForm/EditorForm.razor.cs Added GroupType parameter and conditional CSS class application
src/BootstrapBlazor/Components/GroupBox/GroupBox.razor Changed legend element from label to span for semantic correctness
src/BootstrapBlazor/Components/EditorForm/EditorForm.razor.scss Added styling for RowHeader mode with vertical text and divider
test/UnitTest/Components/EditorFormTest.cs Added test to verify GroupType parameter behavior
src/BootstrapBlazor.Server/Components/Samples/EditorForms.razor Demo showcasing the new GroupType feature with toggle capability
src/BootstrapBlazor.Server/Components/Samples/EditorForms.razor.cs Added _groupType field to support the demo
src/BootstrapBlazor.Server/Locales/en-US.json Added English localization strings for the new feature
src/BootstrapBlazor.Server/Locales/zh-CN.json Added Chinese localization strings for the new feature
src/BootstrapBlazor/BootstrapBlazor.csproj Version bump from beta02 to beta03

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

</Segmented>
</BootstrapInputGroup>
</section>
<EditorForm Model="@Model" GroupType="_groupType">
Copy link

Copilot AI Feb 1, 2026

Choose a reason for hiding this comment

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

Missing @ symbol before the variable reference. The GroupType parameter binding should be GroupType="@_groupType" instead of GroupType="_groupType". Without the @ symbol, the component will receive the literal string "_groupType" rather than the value of the variable.

Suggested change
<EditorForm Model="@Model" GroupType="_groupType">
<EditorForm Model="@Model" GroupType="@_groupType">

Copilot uses AI. Check for mistakes.
"EditorFormTips4": "The buttons in the form can be set up multiplely, just set the buttons <code>Buttons</code> template",
"GroupBoxTitle": "An example of a form",
"GroupDescription": "Grouping is enabled by setting the <code>GroupName</code> parameter of the <code>EditorItem</code> component, and the order is controlled by <code>GroupOrder</code>.",
"GroupIntro": "The grouping format can be controlled by setting the <code>groupType</code> value.",
Copy link

Copilot AI Feb 1, 2026

Choose a reason for hiding this comment

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

Inconsistent casing for parameter name. The text uses "groupType" (lowercase 'g') but should be "GroupType" (uppercase 'G') to match the parameter name. Other parameter references in the localization files use proper casing (e.g., "RowType" at line 3733).

Suggested change
"GroupIntro": "The grouping format can be controlled by setting the <code>groupType</code> value.",
"GroupIntro": "The grouping format can be controlled by setting the <code>GroupType</code> value.",

Copilot uses AI. Check for mistakes.
private IStringLocalizer<Foo>? FooLocalizer { get; set; }

private List<string> _ignoreItems = [];
private EditorFormGroupType _groupType = EditorFormGroupType.GroupBox;
Copy link

Copilot AI Feb 1, 2026

Choose a reason for hiding this comment

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

Field '_groupType' can be 'readonly'.

Suggested change
private EditorFormGroupType _groupType = EditorFormGroupType.GroupBox;
private readonly EditorFormGroupType _groupType = EditorFormGroupType.GroupBox;

Copilot uses AI. Check for mistakes.
Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey - I've found 1 issue, and left some high level feedback:

  • The change from a <label> to a <span> for GroupBox legends alters semantics and accessibility behavior; consider confirming that no consumers depended on the label semantics (e.g., screen readers or automation tools) and, if needed, add appropriate ARIA roles or heading semantics to preserve usability.
  • The new .bb-editor-group-row-header layout with vertical legends and a fixed divider could be tight on smaller screens; consider adding responsive adjustments (e.g., media queries to fall back to the default stacked layout) to keep the form usable on narrow viewports.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The change from a `<label>` to a `<span>` for `GroupBox` legends alters semantics and accessibility behavior; consider confirming that no consumers depended on the `label` semantics (e.g., screen readers or automation tools) and, if needed, add appropriate ARIA roles or heading semantics to preserve usability.
- The new `.bb-editor-group-row-header` layout with vertical legends and a fixed divider could be tight on smaller screens; consider adding responsive adjustments (e.g., media queries to fall back to the default stacked layout) to keep the form usable on narrow viewports.

## Individual Comments

### Comment 1
<location> `test/UnitTest/Components/EditorFormTest.cs:181-190` </location>
<code_context>
     }

+    [Fact]
+    public void GroupType_Ok()
+    {
+        var foo = new Foo();
+        var cut = Context.Render<EditorForm<Foo>>(pb =>
+        {
+            pb.Add(a => a.Model, foo);
+            pb.Add(a => a.GroupType, EditorFormGroupType.GroupBox);
+        });
+
+        cut.DoesNotContain("bb-editor-group-row-header");
+
+        cut.Render(pb =>
+        {
+            pb.Add(a => a.GroupType, EditorFormGroupType.RowHeader);
+        });
+        cut.Contains("bb-editor-group-row-header");
+    }
+
</code_context>

<issue_to_address>
**suggestion (testing):** Add a test to verify the default GroupType behavior when the parameter is not set.

This test only validates explicit `GroupType` values and never asserts the default. Please add a separate test that renders `EditorForm<Foo>` without setting `GroupType` and verifies that the `bb-editor-group-row-header` CSS class is absent, so we also cover the documented default behavior and guard against regressions in the default/`ClassString` logic.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment on lines +181 to +190
public void GroupType_Ok()
{
var foo = new Foo();
var cut = Context.Render<EditorForm<Foo>>(pb =>
{
pb.Add(a => a.Model, foo);
pb.Add(a => a.GroupType, EditorFormGroupType.GroupBox);
});

cut.DoesNotContain("bb-editor-group-row-header");
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion (testing): Add a test to verify the default GroupType behavior when the parameter is not set.

This test only validates explicit GroupType values and never asserts the default. Please add a separate test that renders EditorForm<Foo> without setting GroupType and verifies that the bb-editor-group-row-header CSS class is absent, so we also cover the documented default behavior and guard against regressions in the default/ClassString logic.

@ArgoZhang ArgoZhang restored the dev-group branch February 1, 2026 02:07
@ArgoZhang ArgoZhang deleted the dev-group branch February 1, 2026 02:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(EditorForm): add EditorFormGroupType parameter

2 participants