Skip to content

feat(BootstrapInputGroupLabel): add IsGroupLabel parameter#7257

Merged
ArgoZhang merged 5 commits intomainfrom
refactor-select
Dec 5, 2025
Merged

feat(BootstrapInputGroupLabel): add IsGroupLabel parameter#7257
ArgoZhang merged 5 commits intomainfrom
refactor-select

Conversation

@ArgoZhang
Copy link
Copy Markdown
Member

@ArgoZhang ArgoZhang commented Dec 5, 2025

Link issues

fixes #7256

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 configurability for treating BootstrapInputGroupLabel as a group label and adjust related styling.

New Features:

  • Allow BootstrapInputGroupLabel to be explicitly marked as a group label via an IsGroupLabel parameter.

Enhancements:

  • Update button styles so input-group-text elements adjacent to buttons have appropriate border radii.
  • Scope table toolbar column dropdown menu styling to dropdown-column containers to avoid over-broad selectors.

Copilot AI review requested due to automatic review settings December 5, 2025 06:20
@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai bot commented Dec 5, 2025

Reviewer's Guide

Introduces an optional IsGroupLabel parameter to BootstrapInputGroupLabel to explicitly mark labels used within input groups or table toolbars, adjusts its internal detection logic, and adds small SCSS tweaks for button/input-group radius handling and table toolbar dropdown layout.

Class diagram for updated BootstrapInputGroupLabel component

classDiagram
    class DisplayBase_string {
    }

    class BootstrapInputGroupLabel {
        +RenderFragment ChildContent
        +bool~nullable~ IsGroupLabel
        -string Required
        -bool IsInputGroupLabel
    }

    DisplayBase_string <|-- BootstrapInputGroupLabel
Loading

File-Level Changes

Change Details Files
Add IsGroupLabel parameter to BootstrapInputGroupLabel and wire it into group-label detection logic.
  • Introduce nullable bool IsGroupLabel component parameter with documentation comment.
  • Update IsInputGroupLabel to resolve from IsGroupLabel when set, otherwise fall back to detecting presence of InputGroup.
src/BootstrapBlazor/Components/Input/BootstrapInputGroupLabel.cs
Refine styling for buttons with input-group text children to avoid double-rounded corners.
  • Add CSS selectors under .btn to remove left border radius on non-first .input-group-text children.
  • Add CSS selectors under .btn to remove right border radius on non-last .input-group-text children.
src/BootstrapBlazor/Components/Button/Button.razor.scss
Scope table toolbar column dropdown menu styling more narrowly.
  • Change selector from .table-toolbar .dropdown-menu to .table-toolbar .dropdown-column .dropdown-menu to limit column list height styling.
src/BootstrapBlazor/Components/Table/Table.razor.scss

Assessment against linked issues

Issue Objective Addressed Explanation
#7256 Add an IsGroupLabel parameter to the BootstrapInputGroupLabel component API.
#7256 Use the IsGroupLabel parameter in the component logic to control whether it is treated as an input-group (or toolbar) label.

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

@bb-auto bb-auto bot added the enhancement New feature or request label Dec 5, 2025
@bb-auto bb-auto bot added this to the v10.1.0 milestone Dec 5, 2025
sourcery-ai[bot]
sourcery-ai bot previously approved these changes Dec 5, 2025
Copy link
Copy Markdown
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 there - I've reviewed your changes - here's some feedback:

  • The new IsGroupLabel parameter effectively overrides the existing InputGroup != null detection; if both are set, it might be worth clarifying in XML comments that IsGroupLabel takes precedence so consumers understand the interaction.
  • The added .btn > .input-group-text border-radius rules are quite specific; if you intend the same behavior outside of direct-child scenarios (e.g., wrapped elements), consider whether a less strict selector is needed or if additional selectors should be added.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The new `IsGroupLabel` parameter effectively overrides the existing `InputGroup != null` detection; if both are set, it might be worth clarifying in XML comments that `IsGroupLabel` takes precedence so consumers understand the interaction.
- The added `.btn > .input-group-text` border-radius rules are quite specific; if you intend the same behavior outside of direct-child scenarios (e.g., wrapped elements), consider whether a less strict selector is needed or if additional selectors should be added.

## Individual Comments

### Comment 1
<location> `src/BootstrapBlazor/Components/Table/Table.razor.scss:310` </location>
<code_context>
 }

-.table-toolbar .dropdown-menu {
+.table-toolbar .dropdown-column .dropdown-menu {
     max-height: var(--bb-table-columnlist-max-height);
     overflow: auto;
</code_context>

<issue_to_address>
**issue (bug_risk):** Narrowing the selector may unintentionally drop max-height/scrolling from other toolbar dropdowns.

This change means only `.dropdown-menu` elements within `.dropdown-column` get the max-height and scroll; any other toolbar dropdowns (e.g. actions, filters) that relied on this behavior will lose it. If the goal is to limit the style to column selection, please confirm no other toolbar dropdowns depend on it, or apply an equivalent rule where needed.
</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.

@codecov
Copy link
Copy Markdown

codecov bot commented Dec 5, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (17edba3) to head (2295fcf).
⚠️ Report is 8 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #7257   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          745       745           
  Lines        32584     32585    +1     
  Branches      4515      4516    +1     
=========================================
+ Hits         32584     32585    +1     
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.

@ArgoZhang ArgoZhang merged commit fd396e3 into main Dec 5, 2025
6 checks passed
@ArgoZhang ArgoZhang deleted the refactor-select branch December 5, 2025 06:29
Copy link
Copy Markdown
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 an IsGroupLabel parameter to the BootstrapInputGroupLabel component that allows manual control over whether the label should be rendered as a group label (with input-group-text class and div tag) or a regular form label (with form-label class and label tag). This provides flexibility for scenarios where automatic detection via the cascading InputGroup parameter may not work as expected, particularly when used in TableToolbar contexts.

Key Changes

  • Added nullable boolean IsGroupLabel parameter to BootstrapInputGroupLabel that enables explicit control over label rendering behavior
  • Updated CSS selectors in Table component for more specific dropdown menu targeting
  • Enhanced Button group styling to handle input-group-text elements with proper border radius resets

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/BootstrapBlazor/Components/Input/BootstrapInputGroupLabel.cs Added IsGroupLabel parameter with null-coalescing logic to override automatic group label detection
src/BootstrapBlazor/Components/Table/Table.razor.scss Refined dropdown menu selector to target .dropdown-column .dropdown-menu for better specificity
src/BootstrapBlazor/Components/Button/Button.razor.scss Added border radius reset rules for .input-group-text children within .btn-group to ensure proper visual continuity

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

Comment on lines +54 to +58
/// <summary>
/// 获得/设置 是否为 InputGroup 或 TableToolbar 内的标签 默认 null 未设置
/// </summary>
[Parameter]
public bool? IsGroupLabel { get; set; }
Copy link

Copilot AI Dec 5, 2025

Choose a reason for hiding this comment

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

The new IsGroupLabel parameter lacks test coverage. Consider adding test cases to verify:

  1. The parameter correctly overrides the automatic detection when set to true
  2. The parameter correctly overrides the automatic detection when set to false
  3. The behavior when the parameter is null (default) matches the existing auto-detection logic

Example test case structure:

[Fact]
public void IsGroupLabel_Override_Ok()
{
    // Test explicit true
    var cut = Context.Render<BootstrapInputGroupLabel>(builder =>
    {
        builder.Add(s => s.DisplayText, "Test");
        builder.Add(s => s.IsGroupLabel, true);
    });
    cut.MarkupMatches("<div class=\"input-group-text\">Test</div>");
    
    // Test explicit false
    cut.Render(pb => pb.Add(s => s.IsGroupLabel, false));
    cut.MarkupMatches("<label class=\"form-label\">Test</label>");
}

Copilot uses AI. Check for mistakes.
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(BootstrapInputGroupLabel): add IsGroupLabel parameter

2 participants