feat(BootstrapInputGroupLabel): add IsGroupLabel parameter#7257
feat(BootstrapInputGroupLabel): add IsGroupLabel parameter#7257
Conversation
Reviewer's GuideIntroduces 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 componentclassDiagram
class DisplayBase_string {
}
class BootstrapInputGroupLabel {
+RenderFragment ChildContent
+bool~nullable~ IsGroupLabel
-string Required
-bool IsInputGroupLabel
}
DisplayBase_string <|-- BootstrapInputGroupLabel
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey there - I've reviewed your changes - here's some feedback:
- The new
IsGroupLabelparameter effectively overrides the existingInputGroup != nulldetection; if both are set, it might be worth clarifying in XML comments thatIsGroupLabeltakes precedence so consumers understand the interaction. - The added
.btn > .input-group-textborder-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>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Codecov Report✅ All modified and coverable lines are covered by tests. 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
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
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
IsGroupLabelparameter toBootstrapInputGroupLabelthat 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.
| /// <summary> | ||
| /// 获得/设置 是否为 InputGroup 或 TableToolbar 内的标签 默认 null 未设置 | ||
| /// </summary> | ||
| [Parameter] | ||
| public bool? IsGroupLabel { get; set; } |
There was a problem hiding this comment.
The new IsGroupLabel parameter lacks test coverage. Consider adding test cases to verify:
- The parameter correctly overrides the automatic detection when set to
true - The parameter correctly overrides the automatic detection when set to
false - 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>");
}
Link issues
fixes #7256
Summary By Copilot
Regression?
Risk
Verification
Packaging changes reviewed?
☑️ Self Check before Merge
Summary by Sourcery
Add configurability for treating BootstrapInputGroupLabel as a group label and adjust related styling.
New Features:
Enhancements: