Apply BitMenuButton improvements (#11007)#12317
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughAdds split-mode toggle state and OnToggleChange, callout Background theming, NoIcon header suppression, selected-item handling in callout, SCSS utilities, updated demos and sample snippets, and unit tests. ChangesBitMenuButton Feature Expansion
Sequence Diagram (header toggle flow)sequenceDiagram
participant User
participant BitMenuButton
participant OnToggleChange
participant Callout
User->>BitMenuButton: Click header operator (when Toggle && Split)
BitMenuButton->>BitMenuButton: flip IsToggled
BitMenuButton->>OnToggleChange: invoke OnToggleChange(IsToggled)
Note right of BitMenuButton: toggle does not open Callout
BitMenuButton--xCallout: no open action
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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
`@src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Buttons/MenuButton/_BitMenuButtonCustomDemo.razor.samples.cs`:
- Around line 810-812: example17 has a typo in the Razor text and a mismatch
between the Razor RTL sample and example17CsharpCode: correct the displayed Text
value from "گرینه ها" to "گزینه ها" in the BitMenuButton instance and make the
C# backing data (example17CsharpCode / the rtlCustoms Operation model)
consistent with the Razor attributes — either change the C# items to set
IconName properties if the Razor uses IconName/ChevronDownIconName, or update
the Razor to use Image (or whatever property the Operation model defines) so
both sides reference the same field; also apply the same fixes to the
corresponding samples around lines 823–835.
🪄 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: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: cdbe0b67-e5ae-440a-a8e9-e45769a53644
📒 Files selected for processing (14)
src/BlazorUI/Bit.BlazorUI/Components/Buttons/MenuButton/BitMenuButton.razorsrc/BlazorUI/Bit.BlazorUI/Components/Buttons/MenuButton/BitMenuButton.razor.cssrc/BlazorUI/Bit.BlazorUI/Components/Buttons/MenuButton/BitMenuButton.scsssrc/BlazorUI/Bit.BlazorUI/Components/Buttons/MenuButton/BitMenuButtonClassStyles.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Buttons/MenuButton/BitMenuButtonDemo.razor.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Buttons/MenuButton/_BitMenuButtonCustomDemo.razorsrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Buttons/MenuButton/_BitMenuButtonCustomDemo.razor.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Buttons/MenuButton/_BitMenuButtonCustomDemo.razor.samples.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Buttons/MenuButton/_BitMenuButtonItemDemo.razorsrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Buttons/MenuButton/_BitMenuButtonItemDemo.razor.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Buttons/MenuButton/_BitMenuButtonItemDemo.razor.samples.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Buttons/MenuButton/_BitMenuButtonOptionDemo.razorsrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Buttons/MenuButton/_BitMenuButtonOptionDemo.razor.cssrc/BlazorUI/Tests/Bit.BlazorUI.Tests/Components/Buttons/BitMenuButtonTests.cs
There was a problem hiding this comment.
Pull request overview
This PR implements the requested improvements for BitMenuButton (closes #11007) by adding new component parameters and updating styling, tests, and demo documentation to reflect the new behaviors.
Changes:
- Added
Background(callout background kind),Toggle/IsToggled/DefaultIsToggled/OnToggleChange(toggle behavior in split mode), andNoIcon(hide header icon). - Updated styling to support toggle visuals, selected-item highlighting (sticky-only), and callout background variations.
- Extended bUnit tests and refreshed demo pages/samples to cover and showcase the new API.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/BlazorUI/Tests/Bit.BlazorUI.Tests/Components/Buttons/BitMenuButtonTests.cs | Adds tests for Background, NoIcon, Toggle, and sticky-only selected-item styling. |
| src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Buttons/MenuButton/BitMenuButtonDemo.razor.cs | Documents new parameters and adds BitColorKind enum section for demo docs. |
| src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Buttons/MenuButton/_BitMenuButtonOptionDemo.razor.cs | Adds new example snippets for Background/Toggle/NoIcon/SelectedItem and renumbers examples. |
| src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Buttons/MenuButton/_BitMenuButtonOptionDemo.razor | Adds new demo sections for Background/Toggle/NoIcon/SelectedItem and shifts subsequent examples. |
| src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Buttons/MenuButton/_BitMenuButtonItemDemo.razor.samples.cs | Adds new item-based sample snippets for Background/Toggle/NoIcon/SelectedItem and renumbers later examples. |
| src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Buttons/MenuButton/_BitMenuButtonItemDemo.razor.cs | Adds backing fields used by new Toggle demo examples. |
| src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Buttons/MenuButton/_BitMenuButtonItemDemo.razor | Adds item-based demo sections for Background/Toggle/NoIcon/SelectedItem and shifts subsequent examples. |
| src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Buttons/MenuButton/_BitMenuButtonCustomDemo.razor.samples.cs | Adds new custom-model sample snippets for Background/Toggle/NoIcon/SelectedItem and renumbers later examples. |
| src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Buttons/MenuButton/_BitMenuButtonCustomDemo.razor.cs | Adds backing fields used by new Toggle demo examples. |
| src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Buttons/MenuButton/_BitMenuButtonCustomDemo.razor | Adds custom-model demo sections for Background/Toggle/NoIcon/SelectedItem and shifts subsequent examples. |
| src/BlazorUI/Bit.BlazorUI/Components/Buttons/MenuButton/BitMenuButtonClassStyles.cs | Adds Toggled classes/styles slot for the toggled state. |
| src/BlazorUI/Bit.BlazorUI/Components/Buttons/MenuButton/BitMenuButton.scss | Adds styles for toggled state, sticky selected item, and callout background variants. |
| src/BlazorUI/Bit.BlazorUI/Components/Buttons/MenuButton/BitMenuButton.razor.cs | Introduces new parameters and behaviors (Background/Toggle/IsToggled/NoIcon) and related root CSS classes. |
| src/BlazorUI/Bit.BlazorUI/Components/Buttons/MenuButton/BitMenuButton.razor | Updates rendering to respect NoIcon and applies selected-item class only in Sticky mode. |
|
@coderabbitai re-review |
|
✅ Actions performedFull review triggered. |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 14 out of 14 changed files in this pull request and generated 5 comments.
Comments suppressed due to low confidence (1)
src/BlazorUI/Bit.BlazorUI/Components/Buttons/MenuButton/BitMenuButton.razor.cs:597
HandleOnHeaderClicktogglesIsToggled(and firesOnToggleChange) before checkingGetIsEnabled(item). In Sticky mode the header click passes the selected item, so if a consumer bindsSelectedItemto a disabled item, clicking the header will still toggle even though the click is otherwise treated as disabled. Consider moving the item-enabled check before toggling (whenitemis not null) or gating the toggle logic onitembeing enabled.
if (Toggle && Split)
{
await AssignIsToggled(!IsToggled);
await OnToggleChange.InvokeAsync(IsToggled);
}
if (item is not null)
{
if (GetIsEnabled(item) is false) return;
There was a problem hiding this comment.
Actionable comments posted: 2
♻️ Duplicate comments (1)
src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Buttons/MenuButton/_BitMenuButtonCustomDemo.razor.samples.cs (1)
810-825:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winRestore RTL sample text values (garbled to
?placeholders).Lines 810–825 currently contain placeholder question marks, so the displayed/sample RTL strings are broken.
Proposed fix
-<BitMenuButton Text=""????? ??"" Dir=""BitDir.Rtl"" Items=""rtlCustoms"" IconName=""@BitIconName.Edit"" NameSelectors=""nameSelectors"" /> -<BitMenuButton Text=""????? ??"" Dir=""BitDir.Rtl"" Items=""rtlCustoms"" ChevronDownIconName=""@BitIconName.DoubleChevronDown"" NameSelectors=""nameSelectors"" Split />"; +<BitMenuButton Text=""گزینه ها"" Dir=""BitDir.Rtl"" Items=""rtlCustoms"" IconName=""@BitIconName.Edit"" NameSelectors=""nameSelectors"" /> +<BitMenuButton Text=""گزینه ها"" Dir=""BitDir.Rtl"" Items=""rtlCustoms"" ChevronDownIconName=""@BitIconName.DoubleChevronDown"" NameSelectors=""nameSelectors"" Split />"; - new() { Name = ""????? ???"", Id = ""A"", Image = BitIconName.Emoji }, - new() { Name = ""????? ?"", Id = ""B"", Image = BitIconName.Emoji }, - new() { Name = ""????? ?"", Id = ""C"", Image = BitIconName.Emoji2 } + new() { Name = ""گزینه الف"", Id = ""A"", Image = BitIconName.Emoji }, + new() { Name = ""گزینه ب"", Id = ""B"", Image = BitIconName.Emoji }, + new() { Name = ""گزینه ج"", Id = ""C"", Image = BitIconName.Emoji2 }🤖 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/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Buttons/MenuButton/_BitMenuButtonCustomDemo.razor.samples.cs` around lines 810 - 825, The sample's RTL text was replaced by "?????" placeholders; restore the original RTL strings in both the Razor markup and the C# sample data: update the BitMenuButton Text attributes in the markup snippets (the BitMenuButton instances with Dir="BitDir.Rtl") and the Name values inside the rtlCustoms list in example17CsharpCode so they contain the intended RTL phrases (not question marks), leaving other properties (Id, Image, Disabled, IconName/ChevronDownIconName, NameSelectors, Split) unchanged and matching the original sample semantics.
🤖 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 `@src/BlazorUI/Bit.BlazorUI/Components/Buttons/MenuButton/BitMenuButton.razor`:
- Around line 105-109: The early skip prevents selected-item styling from ever
being applied; compute isSelected before deciding to skip and only skip
non-selected items in Sticky mode. Concretely, move the isSelected assignment
(var isSelected = Sticky && item == SelectedItem) above the conditional and
change the skip condition from if (Sticky && item == SelectedItem) continue; to
if (Sticky && item != SelectedItem) continue; so GetTemplate, GetIsEnabled and
the bit-mnb-sel selected styling logic can run for the selected item.
In
`@src/BlazorUI/Tests/Bit.BlazorUI.Tests/Components/Buttons/BitMenuButtonTests.cs`:
- Around line 347-377: The sticky-mode test
BitMenuButtonSelectedItemShouldHaveSelClassInStickyMode must assert the
selected-item by matching the rendered item that both contains the selected CSS
class and the expected item text/key (e.g., inspect elements from
RenderComponent<BitMenuButton<BitMenuButtonItem>> using FindAll(".bit-mnb-itm")
and filter with b.ClassList.Contains("bit-mnb-sel") &&
b.TextContent.Contains("Item B") or match a data/key attribute) to make the
check deterministic; the non-sticky test
BitMenuButtonSelectedItemShouldNotHaveSelClassInNonStickyMode should supply an
items collection that includes an item with IsSelected = true (reuse stickyItems
or create itemsWithSelected) while setting Sticky = false, then assert there are
zero elements matching ".bit-mnb-sel". Ensure you reference the existing
variables/method RenderComponent<BitMenuButton<BitMenuButtonItem>>, the CSS
selectors ".bit-mnb-itm" and ".bit-mnb-sel", and the item text/key "Item B" when
updating the assertions.
---
Duplicate comments:
In
`@src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Buttons/MenuButton/_BitMenuButtonCustomDemo.razor.samples.cs`:
- Around line 810-825: The sample's RTL text was replaced by "?????"
placeholders; restore the original RTL strings in both the Razor markup and the
C# sample data: update the BitMenuButton Text attributes in the markup snippets
(the BitMenuButton instances with Dir="BitDir.Rtl") and the Name values inside
the rtlCustoms list in example17CsharpCode so they contain the intended RTL
phrases (not question marks), leaving other properties (Id, Image, Disabled,
IconName/ChevronDownIconName, NameSelectors, Split) unchanged and matching the
original sample semantics.
🪄 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: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: b5623624-7e1f-4648-a9cb-0c9b0be6da35
📒 Files selected for processing (14)
src/BlazorUI/Bit.BlazorUI/Components/Buttons/MenuButton/BitMenuButton.razorsrc/BlazorUI/Bit.BlazorUI/Components/Buttons/MenuButton/BitMenuButton.razor.cssrc/BlazorUI/Bit.BlazorUI/Components/Buttons/MenuButton/BitMenuButton.scsssrc/BlazorUI/Bit.BlazorUI/Components/Buttons/MenuButton/BitMenuButtonClassStyles.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Buttons/MenuButton/BitMenuButtonDemo.razor.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Buttons/MenuButton/_BitMenuButtonCustomDemo.razorsrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Buttons/MenuButton/_BitMenuButtonCustomDemo.razor.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Buttons/MenuButton/_BitMenuButtonCustomDemo.razor.samples.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Buttons/MenuButton/_BitMenuButtonItemDemo.razorsrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Buttons/MenuButton/_BitMenuButtonItemDemo.razor.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Buttons/MenuButton/_BitMenuButtonItemDemo.razor.samples.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Buttons/MenuButton/_BitMenuButtonOptionDemo.razorsrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Buttons/MenuButton/_BitMenuButtonOptionDemo.razor.cssrc/BlazorUI/Tests/Bit.BlazorUI.Tests/Components/Buttons/BitMenuButtonTests.cs
|
@coderabbitai re-review |
|
✅ Actions performedFull review triggered. |
There was a problem hiding this comment.
♻️ Duplicate comments (1)
src/BlazorUI/Bit.BlazorUI/Components/Buttons/MenuButton/BitMenuButton.razor (1)
105-118:⚠️ Potential issue | 🟠 Major | ⚡ Quick winSelected-item styling logic is still inverted for Sticky mode.
At Line 106, the selected item is skipped in Sticky mode, so the
bit-mnb-selclass at Line 118 never applies there. Also, Line 105 computes selection withoutSticky, so non-sticky mode can still receive selected styling.Suggested fix
- var isSelected = item == SelectedItem; - if (Sticky && isSelected) continue; + var isSelected = Sticky && item == SelectedItem;🤖 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/BlazorUI/Bit.BlazorUI/Components/Buttons/MenuButton/BitMenuButton.razor` around lines 105 - 118, The selected-item logic is inverted: currently you set isSelected = item == SelectedItem and then do if (Sticky && isSelected) continue, which skips rendering the selected item in Sticky mode so the "bit-mnb-sel" class never applies; change the conditional to skip the selected item only when NOT Sticky (i.e., use if (!Sticky && isSelected) continue) so SelectedItem is still rendered and receives the bit-mnb-sel class when Sticky is true; keep the isSelected variable and class usage (bit-mnb-sel, GetItemKey, GetClass, GetStyle, HandleOnItemClick) intact.
🤖 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.
Duplicate comments:
In `@src/BlazorUI/Bit.BlazorUI/Components/Buttons/MenuButton/BitMenuButton.razor`:
- Around line 105-118: The selected-item logic is inverted: currently you set
isSelected = item == SelectedItem and then do if (Sticky && isSelected)
continue, which skips rendering the selected item in Sticky mode so the
"bit-mnb-sel" class never applies; change the conditional to skip the selected
item only when NOT Sticky (i.e., use if (!Sticky && isSelected) continue) so
SelectedItem is still rendered and receives the bit-mnb-sel class when Sticky is
true; keep the isSelected variable and class usage (bit-mnb-sel, GetItemKey,
GetClass, GetStyle, HandleOnItemClick) intact.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: fa49c446-ac91-4cdb-b92c-16e3cf4e5b49
📒 Files selected for processing (14)
src/BlazorUI/Bit.BlazorUI/Components/Buttons/MenuButton/BitMenuButton.razorsrc/BlazorUI/Bit.BlazorUI/Components/Buttons/MenuButton/BitMenuButton.razor.cssrc/BlazorUI/Bit.BlazorUI/Components/Buttons/MenuButton/BitMenuButton.scsssrc/BlazorUI/Bit.BlazorUI/Components/Buttons/MenuButton/BitMenuButtonClassStyles.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Buttons/MenuButton/BitMenuButtonDemo.razor.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Buttons/MenuButton/_BitMenuButtonCustomDemo.razorsrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Buttons/MenuButton/_BitMenuButtonCustomDemo.razor.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Buttons/MenuButton/_BitMenuButtonCustomDemo.razor.samples.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Buttons/MenuButton/_BitMenuButtonItemDemo.razorsrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Buttons/MenuButton/_BitMenuButtonItemDemo.razor.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Buttons/MenuButton/_BitMenuButtonItemDemo.razor.samples.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Buttons/MenuButton/_BitMenuButtonOptionDemo.razorsrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Buttons/MenuButton/_BitMenuButtonOptionDemo.razor.cssrc/BlazorUI/Tests/Bit.BlazorUI.Tests/Components/Buttons/BitMenuButtonTests.cs
|
@coderabbitai re-review |
|
✅ Actions performedFull review triggered. |
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Buttons/MenuButton/_BitMenuButtonCustomDemo.razor.samples.cs (1)
345-367:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winSample model-property usage is inconsistent (
IconvsImage).These snippet blocks initialize
OperationwithIcon = ..., but the same snippet model/selectors useImage(IconName = nameof(Operation.Image)). This makes the shown snippets inconsistent and misleading.Suggested fix
- new() { Name = ""Custom A"", Id = ""A"", Icon = BitIconName.Emoji } + new() { Name = ""Custom A"", Id = ""A"", Image = BitIconName.Emoji }Apply the same
Icon→Imagecorrection across the listed sample blocks.Also applies to: 446-460, 568-609, 639-660, 683-708
🤖 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/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Buttons/MenuButton/_BitMenuButtonCustomDemo.razor.samples.cs` around lines 345 - 367, The sample model uses property names inconsistently: the Operation class defines Image but the list initializers set Icon (in basicIconCustoms) while the selectors set IconName = nameof(Operation.Image); to fix, make the property names consistent across the sample blocks (either rename all initializer fields to Image or change the selector to IconName = nameof(Operation.Icon)) by updating the basicIconCustoms initializers and the BitMenuButtonNameSelectors<Operation> (Text, Key, IconName, IsEnabled) in the indicated samples so they reference the same property name (apply the same change to the other sample blocks at the noted locations).
🤖 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 `@src/BlazorUI/Bit.BlazorUI/Components/Buttons/MenuButton/BitMenuButton.scss`:
- Line 1: The SCSS import in BitMenuButton.scss includes the file extension
which trips the scss/load-partial-extension rule; update the import statement
that references functions.scss (the `@import` "../../../Styles/functions.scss"
line) to remove the ".scss" extension (i.e., import "../../../Styles/functions")
so stylelint passes.
In
`@src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Buttons/MenuButton/_BitMenuButtonCustomDemo.razor.samples.cs`:
- Around line 342-345: The Razor sample string example5RazorCode is binding
Items to the wrong collection (basicCustoms) while the C# sample defines
basicIconCustoms; update the Items binding in example5RazorCode from
Items="basicCustoms" to Items="basicIconCustoms" so the Razor and C# snippets
match (leave NameSelectors, IconName, ChevronDownIconName and Split as-is).
---
Outside diff comments:
In
`@src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Buttons/MenuButton/_BitMenuButtonCustomDemo.razor.samples.cs`:
- Around line 345-367: The sample model uses property names inconsistently: the
Operation class defines Image but the list initializers set Icon (in
basicIconCustoms) while the selectors set IconName = nameof(Operation.Image); to
fix, make the property names consistent across the sample blocks (either rename
all initializer fields to Image or change the selector to IconName =
nameof(Operation.Icon)) by updating the basicIconCustoms initializers and the
BitMenuButtonNameSelectors<Operation> (Text, Key, IconName, IsEnabled) in the
indicated samples so they reference the same property name (apply the same
change to the other sample blocks at the noted locations).
🪄 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: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 92e85e5c-e49d-4728-ab0c-8287afc5b8d2
📒 Files selected for processing (14)
src/BlazorUI/Bit.BlazorUI/Components/Buttons/MenuButton/BitMenuButton.razorsrc/BlazorUI/Bit.BlazorUI/Components/Buttons/MenuButton/BitMenuButton.razor.cssrc/BlazorUI/Bit.BlazorUI/Components/Buttons/MenuButton/BitMenuButton.scsssrc/BlazorUI/Bit.BlazorUI/Components/Buttons/MenuButton/BitMenuButtonClassStyles.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Buttons/MenuButton/BitMenuButtonDemo.razor.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Buttons/MenuButton/_BitMenuButtonCustomDemo.razorsrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Buttons/MenuButton/_BitMenuButtonCustomDemo.razor.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Buttons/MenuButton/_BitMenuButtonCustomDemo.razor.samples.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Buttons/MenuButton/_BitMenuButtonItemDemo.razorsrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Buttons/MenuButton/_BitMenuButtonItemDemo.razor.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Buttons/MenuButton/_BitMenuButtonItemDemo.razor.samples.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Buttons/MenuButton/_BitMenuButtonOptionDemo.razorsrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Buttons/MenuButton/_BitMenuButtonOptionDemo.razor.cssrc/BlazorUI/Tests/Bit.BlazorUI.Tests/Components/Buttons/BitMenuButtonTests.cs
|
@coderabbitai re-review |
|
✅ Actions performedFull review triggered. ✅ Actions performedFull review triggered. |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (3)
src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Buttons/MenuButton/_BitMenuButtonItemDemo.razor.samples.cs (1)
328-333:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winFix invalid sample snippet in
Stylesinitializer.There is an extra
{afternew()that makes the shown Razor snippet invalid when copied.Proposed fix
- Styles=""@(new() { { Root = ""--button-background: tomato; background: var(--button-background); border-color: var(--button-background); border-radius: 0.25rem;"", + Styles=""@(new() { Root = ""--button-background: tomato; background: var(--button-background); border-color: var(--button-background); border-radius: 0.25rem;"", Opened = ""--button-background: orangered;"", OperatorButton = ""background: var(--button-background);"", ItemButton = ""background: lightcoral;"", Callout = ""border-radius: 0.25rem; box-shadow: lightgray 0 0 0.5rem;"" })"" />";🤖 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/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Buttons/MenuButton/_BitMenuButtonItemDemo.razor.samples.cs` around lines 328 - 333, The Razor sample for BitMenuButton has an extra opening brace in the Styles initializer making the snippet invalid; update the Styles attribute in the BitMenuButton sample (the Styles="@(new() { { Root = ... })" expression) to remove the stray '{' so it becomes Styles="@(new() { Root = "...", Opened = "...", OperatorButton = "...", ItemButton = "...", Callout = "..." })", preserving the same keys/values and formatting.src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Buttons/MenuButton/_BitMenuButtonOptionDemo.razor.cs (1)
1183-1187:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winKeep RTL snippet consistent with the rendered Split example.
example17RazorCodesecond menu button usesChevronDownIconNamebut omitsSplit, so the shown snippet does not match the actual RTL demo behavior.Suggested fix
-<BitMenuButton Text=""گزینه ها"" Dir=""BitDir.Rtl"" TItem=""BitMenuButtonOption"" ChevronDownIconName=""@BitIconName.DoubleChevronDown""> +<BitMenuButton Text=""گزینه ها"" Dir=""BitDir.Rtl"" TItem=""BitMenuButtonOption"" ChevronDownIconName=""@BitIconName.DoubleChevronDown"" Split>🤖 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/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Buttons/MenuButton/_BitMenuButtonOptionDemo.razor.cs` around lines 1183 - 1187, The RTL example snippet in example17RazorCode is inconsistent with the rendered Split demo because the second BitMenuButton includes ChevronDownIconName but is missing the Split attribute; update the example17RazorCode snippet to add Split="true" (or include the Split attribute) to the second BitMenuButton so the Razor snippet matches the actual rendered Split behavior for the RTL demo.src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Buttons/MenuButton/_BitMenuButtonCustomDemo.razor.samples.cs (1)
345-367:⚠️ Potential issue | 🟡 Minor | ⚡ Quick win
example5CsharpCodeuses a non-existent property in the sample model.The sample model defines
Image, but the sample items assignIcon. This breaks copy/paste correctness for the snippet and conflicts withnameSelectors.IconName.Suggested fix
private static List<Operation> basicIconCustoms = [ - new() { Name = ""Custom A"", Id = ""A"", Icon = BitIconName.Emoji }, - new() { Name = ""Custom B"", Id = ""B"", Icon = BitIconName.Emoji }, - new() { Name = ""Custom C"", Id = ""C"", Icon = BitIconName.Emoji2 } + new() { Name = ""Custom A"", Id = ""A"", Image = BitIconName.Emoji }, + new() { Name = ""Custom B"", Id = ""B"", Image = BitIconName.Emoji }, + new() { Name = ""Custom C"", Id = ""C"", Image = BitIconName.Emoji2 } ];🤖 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/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Buttons/MenuButton/_BitMenuButtonCustomDemo.razor.samples.cs` around lines 345 - 367, The sample string example5CsharpCode contains a model Operation with property Image but the items in basicIconCustoms initialize Icon, which breaks the IconName selector; update the sample so the items use Image (or alternatively add an Icon property to Operation and update nameSelectors) so that basicIconCustoms initializes the same property referenced by nameSelectors.IconName (ensure Operation, basicIconCustoms and nameSelectors inside example5CsharpCode are consistent).
♻️ Duplicate comments (1)
src/BlazorUI/Bit.BlazorUI/Components/Buttons/MenuButton/BitMenuButton.scss (1)
1-1:⚠️ Potential issue | 🟠 Major | ⚡ Quick winRemove
.scssextension from the import to satisfy stylelint.This still violates
scss/load-partial-extensionand can fail linted builds.Proposed fix
-@import "../../../Styles/functions.scss"; +@import "../../../Styles/functions";🤖 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/BlazorUI/Bit.BlazorUI/Components/Buttons/MenuButton/BitMenuButton.scss` at line 1, The import in BitMenuButton.scss uses a file extension which triggers the scss/load-partial-extension lint rule; update the import statement that currently references "../../../Styles/functions.scss" to remove the ".scss" extension (use "../../../Styles/functions") so the partial import follows the stylelint convention and the linted build will pass.
🤖 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 `@src/BlazorUI/Bit.BlazorUI/Components/Buttons/MenuButton/BitMenuButton.scss`:
- Around line 110-113: The .bit-mnb-cal rule is missing a blank line before the
display declaration which trips declaration-empty-line-before; edit the
.bit-mnb-cal block (the rule that contains --bit-mnb-cal and --bit-mnb-cal-tra)
and insert a single empty line between the CSS custom properties and the
display: none; line so the declarations are separated and the linter passes.
---
Outside diff comments:
In
`@src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Buttons/MenuButton/_BitMenuButtonCustomDemo.razor.samples.cs`:
- Around line 345-367: The sample string example5CsharpCode contains a model
Operation with property Image but the items in basicIconCustoms initialize Icon,
which breaks the IconName selector; update the sample so the items use Image (or
alternatively add an Icon property to Operation and update nameSelectors) so
that basicIconCustoms initializes the same property referenced by
nameSelectors.IconName (ensure Operation, basicIconCustoms and nameSelectors
inside example5CsharpCode are consistent).
In
`@src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Buttons/MenuButton/_BitMenuButtonItemDemo.razor.samples.cs`:
- Around line 328-333: The Razor sample for BitMenuButton has an extra opening
brace in the Styles initializer making the snippet invalid; update the Styles
attribute in the BitMenuButton sample (the Styles="@(new() { { Root = ... })"
expression) to remove the stray '{' so it becomes Styles="@(new() { Root =
"...", Opened = "...", OperatorButton = "...", ItemButton = "...", Callout =
"..." })", preserving the same keys/values and formatting.
In
`@src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Buttons/MenuButton/_BitMenuButtonOptionDemo.razor.cs`:
- Around line 1183-1187: The RTL example snippet in example17RazorCode is
inconsistent with the rendered Split demo because the second BitMenuButton
includes ChevronDownIconName but is missing the Split attribute; update the
example17RazorCode snippet to add Split="true" (or include the Split attribute)
to the second BitMenuButton so the Razor snippet matches the actual rendered
Split behavior for the RTL demo.
---
Duplicate comments:
In `@src/BlazorUI/Bit.BlazorUI/Components/Buttons/MenuButton/BitMenuButton.scss`:
- Line 1: The import in BitMenuButton.scss uses a file extension which triggers
the scss/load-partial-extension lint rule; update the import statement that
currently references "../../../Styles/functions.scss" to remove the ".scss"
extension (use "../../../Styles/functions") so the partial import follows the
stylelint convention and the linted build will pass.
🪄 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: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 47437973-7000-4e30-82a2-fc6031d8cf52
📒 Files selected for processing (14)
src/BlazorUI/Bit.BlazorUI/Components/Buttons/MenuButton/BitMenuButton.razorsrc/BlazorUI/Bit.BlazorUI/Components/Buttons/MenuButton/BitMenuButton.razor.cssrc/BlazorUI/Bit.BlazorUI/Components/Buttons/MenuButton/BitMenuButton.scsssrc/BlazorUI/Bit.BlazorUI/Components/Buttons/MenuButton/BitMenuButtonClassStyles.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Buttons/MenuButton/BitMenuButtonDemo.razor.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Buttons/MenuButton/_BitMenuButtonCustomDemo.razorsrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Buttons/MenuButton/_BitMenuButtonCustomDemo.razor.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Buttons/MenuButton/_BitMenuButtonCustomDemo.razor.samples.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Buttons/MenuButton/_BitMenuButtonItemDemo.razorsrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Buttons/MenuButton/_BitMenuButtonItemDemo.razor.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Buttons/MenuButton/_BitMenuButtonItemDemo.razor.samples.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Buttons/MenuButton/_BitMenuButtonOptionDemo.razorsrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Buttons/MenuButton/_BitMenuButtonOptionDemo.razor.cssrc/BlazorUI/Tests/Bit.BlazorUI.Tests/Components/Buttons/BitMenuButtonTests.cs
closes #11007
Summary by CodeRabbit
New Features
Style
Tests