Apply BitDropdown improvements (#12741) - #12745
Conversation
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
WalkthroughBitDropdown adds selection limits, select-all, empty/loading states, search modes, keyboard navigation, accessibility semantics, virtualization support, JavaScript focus integration, size styling, and expanded documentation and demos. ChangesBitDropdown improvements
Estimated code review effort: 4 (Complex) | ~60 minutes Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ 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 |
|
@coderabbitai full-review |
|
✅ Action performedFull review finished. Your plan includes PR reviews subject to rate limits. More reviews will be available in 8 minutes. |
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (3)
src/BlazorUI/Bit.BlazorUI/Scripts/Dropdowns.ts (1)
183-185: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valuePage step is a hard-coded 10 items.
Extract it as a named constant next to
VIRTUALIZE_RENDER_FRAMES, or derive it from the visible window (clientHeight / itemHeight) so PageUp/PageDown match what the user actually sees.🤖 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/Scripts/Dropdowns.ts` around lines 183 - 185, Replace the hard-coded 10-item page step in the nextPage and prevPage branches with a named constant declared alongside VIRTUALIZE_RENDER_FRAMES, or calculate the step from the visible window using clientHeight and itemHeight. Reuse that step for both navigation directions while preserving the existing boundary clamping behavior.src/BlazorUI/Bit.BlazorUI/Components/Inputs/Dropdown/BitDropdown.razor (1)
311-339: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winSelect-all button stays focusable/clickable when the dropdown is disabled or read-only.
The
bit-drp-idsclass is applied forIsEnabled is false, but the<button>itself has nodisabledattribute, so it remains tab-reachable and is also collected by_getItemsinDropdowns.ts.ReadOnlyisn't reflected at all. The click handler bails out, so this is presentation/keyboard-focus only.♻️ Proposed change
<button `@onclick`="HandleOnSelectAllClick" type="button" role="checkbox" + disabled="@(IsEnabled is false || ReadOnly)" + aria-disabled="@(IsEnabled is false || ReadOnly)" style="`@Styles`?.SelectAllButton"🤖 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/Inputs/Dropdown/BitDropdown.razor` around lines 311 - 339, Update the select-all button rendered in the MultiSelect/ShowSelectAll block to be non-focusable and non-clickable when the dropdown is disabled or read-only. Reflect both IsEnabled and ReadOnly on the button’s disabled state so _getItems excludes it, while preserving its current enabled behavior and styling.src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Dropdown/_BitDropdownCustomDemo.razor (1)
707-707: 🚀 Performance & Scalability | 🔵 Trivial | 💤 Low valueConsider
PreventRenderForMcpClienton the Virtualization example for consistency.The equivalent Virtualization example in
_BitDropdownItemDemo.razor(line 685) setsPreventRenderForMcpClient, while this one renders two 10k-item collections plus fourItemsProvider-backed dropdowns.🤖 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/Inputs/Dropdown/_BitDropdownCustomDemo.razor` at line 707, Add PreventRenderForMcpClient to the Virtualization DemoExample identified by Id "example20" and title "Virtualization", matching the equivalent configuration in _BitDropdownItemDemo.razor.
🤖 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/Inputs/Dropdown/BitDropdown.razor`:
- Around line 341-346: Update the listbox markup in BitDropdown to conditionally
emit aria-labelledby using GetDropdownAriaLabelledby(), matching the trigger
behavior. Ensure no aria-labelledby attribute is rendered when neither
LabelTemplate nor Label creates the referenced label element.
In `@src/BlazorUI/Bit.BlazorUI/Components/Inputs/Dropdown/BitDropdown.razor.cs`:
- Around line 1448-1453: Update the callout keydown handling used by
HandleOnCalloutKeyDown and its Dropdowns.ts listener to prevent Tab’s default
browser focus movement, then close the callout and deliberately focus the
appropriate next or previous tabbable element based on Shift+Tab. Preserve
reachability of header/footer template controls and the search box in forward
tab order, rather than always refocusing _dropdownWrapperRef.
In
`@src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Dropdown/_BitDropdownCustomDemo.razor.samples.cs`:
- Around line 1742-1756: Update the sample Product class used by
example22CsharpCode and the corresponding class in the additional sample so it
declares the CssClass and CssStyle properties referenced by the nameSelectors
configuration; keep the existing selectors unchanged and ensure the copied
examples compile.
---
Nitpick comments:
In `@src/BlazorUI/Bit.BlazorUI/Components/Inputs/Dropdown/BitDropdown.razor`:
- Around line 311-339: Update the select-all button rendered in the
MultiSelect/ShowSelectAll block to be non-focusable and non-clickable when the
dropdown is disabled or read-only. Reflect both IsEnabled and ReadOnly on the
button’s disabled state so _getItems excludes it, while preserving its current
enabled behavior and styling.
In `@src/BlazorUI/Bit.BlazorUI/Scripts/Dropdowns.ts`:
- Around line 183-185: Replace the hard-coded 10-item page step in the nextPage
and prevPage branches with a named constant declared alongside
VIRTUALIZE_RENDER_FRAMES, or calculate the step from the visible window using
clientHeight and itemHeight. Reuse that step for both navigation directions
while preserving the existing boundary clamping behavior.
In
`@src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Dropdown/_BitDropdownCustomDemo.razor`:
- Line 707: Add PreventRenderForMcpClient to the Virtualization DemoExample
identified by Id "example20" and title "Virtualization", matching the equivalent
configuration in _BitDropdownItemDemo.razor.
🪄 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 Plus
Run ID: 669d003b-b8c4-424c-b3d5-d5e8679f3ba6
📒 Files selected for processing (19)
src/BlazorUI/Bit.BlazorUI/Components/Inputs/Dropdown/BitDropdown.razorsrc/BlazorUI/Bit.BlazorUI/Components/Inputs/Dropdown/BitDropdown.razor.cssrc/BlazorUI/Bit.BlazorUI/Components/Inputs/Dropdown/BitDropdown.scsssrc/BlazorUI/Bit.BlazorUI/Components/Inputs/Dropdown/BitDropdownClassStyles.cssrc/BlazorUI/Bit.BlazorUI/Components/Inputs/Dropdown/_BitDropdownItem.razorsrc/BlazorUI/Bit.BlazorUI/Extensions/JsInterop/DropdownsJsRuntimeExtensions.cssrc/BlazorUI/Bit.BlazorUI/Scripts/Dropdowns.tssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Dropdown/BitDropdownDemo.razorsrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Dropdown/BitDropdownDemo.razor.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Dropdown/BitDropdownDemo.razor.scsssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Dropdown/_BitDropdownCustomDemo.razorsrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Dropdown/_BitDropdownCustomDemo.razor.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Dropdown/_BitDropdownCustomDemo.razor.samples.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Dropdown/_BitDropdownItemDemo.razorsrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Dropdown/_BitDropdownItemDemo.razor.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Dropdown/_BitDropdownItemDemo.razor.samples.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Dropdown/_BitDropdownOptionDemo.razorsrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Dropdown/_BitDropdownOptionDemo.razor.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Dropdown/_BitDropdownOptionDemo.razor.samples.cs
….com/msynk/bitframework into 12741-blazorui-dropdown-improvements
|
@coderabbitai full-review |
|
✅ Action performedFull review finished. |
There was a problem hiding this comment.
Actionable comments posted: 5
🧹 Nitpick comments (1)
src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Dropdown/_BitDropdownCustomDemo.razor.samples.cs (1)
561-582: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winSeveral new C# samples omit members their Razor sample references.
example9RazorCodeusescomboBoxCustomsandcomboBoxNameSelectors(lines 554-559), butexample9CsharpCodedefines neither, nor theProductclass. Same gap inexample16CsharpCode(razor usesnameSelectors,comboBoxCustoms,comboBoxNameSelectors),example22CsharpCode(razor usesnameSelectors) andexample26CsharpCode(noProduct). Sibling samples (example18,example19,example21) include the full boilerplate — worth aligning so the snippets are copy-pasteable.🤖 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/Inputs/Dropdown/_BitDropdownCustomDemo.razor.samples.cs` around lines 561 - 582, Complete the C# snippets in example9CsharpCode, example16CsharpCode, example22CsharpCode, and example26CsharpCode with every Product, collection, and selector member referenced by their corresponding Razor snippets, including comboBoxCustoms, comboBoxNameSelectors, nameSelectors, and Product as applicable. Align their declarations with the complete boilerplate used by example18, example19, and example21 so each sample is independently copy-pasteable.
🤖 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/Inputs/Dropdown/BitDropdown.razor.cs`:
- Around line 860-883: Add a _positionsSelectionVersion backing field alongside
the existing position-cache fields, and include _selectionVersion in the cache
invalidation condition and cache-key updates within GetItemPositions(). This
must rebuild positions after selection changes, especially when
HideSelectedItems is enabled, while preserving the existing SearchText and
_optionsVersion cache behavior.
In `@src/BlazorUI/Bit.BlazorUI/Components/Inputs/Dropdown/BitDropdown.scss`:
- Around line 1002-1008: Update the small dropdown styles in .bit-drp-sm so the
.bit-drp-pre/.bit-drp-suf height uses var(--bit-drp-h) instead of the fixed
spacing(3.75) value, allowing adorned controls to retain the configured small
height.
In
`@src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Dropdown/_BitDropdownItemDemo.razor.samples.cs`:
- Around line 841-847: Update the example16 sample’s backing declarations to
include the comboBoxItems list required by its BitDropdown Items binding,
matching the existing declaration pattern used in examples 9, 10, 14, 15, and
17. Ensure both the primary block and the additionally referenced range compile
without changing the sample’s other behavior.
In
`@src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Dropdown/_BitDropdownOptionDemo.razor.samples.cs`:
- Around line 1401-1454: Update the example22 C# sample code associated with
example22RazorCode to declare and initialize the basicItems collection before it
is used by the Razor loops and LoadDelayedItems. Keep the existing
isLoadingItems and delayedItems declarations unchanged so the sample remains
self-contained.
- Around line 1102-1112: Update the example16 sample code, including the related
example16CsharpCode block, to declare and initialize the comboBoxItems list
before the BitDropdown markup iterates it. Match the existing comboBoxItems
declaration pattern used by examples 14, 15, and 17 while preserving the
existing basicItems declaration and AutoClearSearch sample behavior.
---
Nitpick comments:
In
`@src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Dropdown/_BitDropdownCustomDemo.razor.samples.cs`:
- Around line 561-582: Complete the C# snippets in example9CsharpCode,
example16CsharpCode, example22CsharpCode, and example26CsharpCode with every
Product, collection, and selector member referenced by their corresponding Razor
snippets, including comboBoxCustoms, comboBoxNameSelectors, nameSelectors, and
Product as applicable. Align their declarations with the complete boilerplate
used by example18, example19, and example21 so each sample is independently
copy-pasteable.
🪄 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 Plus
Run ID: b79a8b8a-4de8-432f-a479-7002c7295fb6
📒 Files selected for processing (21)
src/BlazorUI/Bit.BlazorUI/Components/Inputs/Dropdown/BitDropdown.razorsrc/BlazorUI/Bit.BlazorUI/Components/Inputs/Dropdown/BitDropdown.razor.cssrc/BlazorUI/Bit.BlazorUI/Components/Inputs/Dropdown/BitDropdown.scsssrc/BlazorUI/Bit.BlazorUI/Components/Inputs/Dropdown/BitDropdownClassStyles.cssrc/BlazorUI/Bit.BlazorUI/Components/Inputs/Dropdown/BitDropdownSearchMode.cssrc/BlazorUI/Bit.BlazorUI/Components/Inputs/Dropdown/_BitDropdownItem.razorsrc/BlazorUI/Bit.BlazorUI/Extensions/JsInterop/DropdownsJsRuntimeExtensions.cssrc/BlazorUI/Bit.BlazorUI/Scripts/Dropdowns.tssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Dropdown/BitDropdownDemo.razorsrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Dropdown/BitDropdownDemo.razor.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Dropdown/BitDropdownDemo.razor.scsssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Dropdown/_BitDropdownCustomDemo.razorsrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Dropdown/_BitDropdownCustomDemo.razor.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Dropdown/_BitDropdownCustomDemo.razor.samples.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Dropdown/_BitDropdownItemDemo.razorsrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Dropdown/_BitDropdownItemDemo.razor.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Dropdown/_BitDropdownItemDemo.razor.samples.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Dropdown/_BitDropdownOptionDemo.razorsrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Dropdown/_BitDropdownOptionDemo.razor.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Dropdown/_BitDropdownOptionDemo.razor.samples.cssrc/BlazorUI/Tests/Bit.BlazorUI.Tests/Components/Inputs/Dropdown/BitDropdownTests.cs
|
@coderabbitai full-review |
|
✅ Action performedFull review finished. |
There was a problem hiding this comment.
Actionable comments posted: 4
🧹 Nitpick comments (3)
src/BlazorUI/Bit.BlazorUI/Components/Inputs/Dropdown/BitDropdownSearchMode.cs (1)
20-23: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win
Equalsas a member name hidesobject.Equalson the type.
BitDropdownSearchMode.Equals(a, b)no longer resolves to the staticobject.Equalsoverload, and the name reads oddly in an enum of match modes. Renaming later would be a breaking public API change, so considerExactMatch(orExact) now.🤖 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/Inputs/Dropdown/BitDropdownSearchMode.cs` around lines 20 - 23, Rename the BitDropdownSearchMode enum member Equals to a non-conflicting match-mode name such as ExactMatch, and update all references to the member accordingly. Preserve the existing exact text matching behavior while avoiding shadowing object.Equals and establishing the corrected public API name now.src/BlazorUI/Bit.BlazorUI/Components/Inputs/Dropdown/BitDropdown.razor.cs (1)
1744-1750: 🩺 Stability & Availability | 🔵 Trivial | 💤 Low valueFire-and-forget
ClearComboBoxInputnow reachesVirtualize.RefreshDataAsync.
ClearComboBoxInputawaitsSearchVirtualized(), so this discarded task performs JS/render work outside the caller's flow; any exception (e.g. anObjectDisposedExceptionwhen the component is torn down while the callout closes) is unobservable. Consider awaiting these from the caller ofOnSetIsOpenor at least logging the faulted task.🤖 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/Inputs/Dropdown/BitDropdown.razor.cs` around lines 1744 - 1750, Update the OnSetIsOpen flow to await ClearComboBoxInput instead of discarding its task, allowing the SearchVirtualized and Virtualize.RefreshDataAsync work and exceptions to remain in the caller’s async flow. Preserve the existing ordering so the combo input is cleared before invoking OnOpen or OnClose.src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Dropdown/_BitDropdownCustomDemo.razor.samples.cs (1)
626-628: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueCombo sample
TextSetterlambdas declare a nullable first parameter.BitDropdownNameSelectors.TextSetterisAction<string, TItem>?and the real code-behind uses(string text, Product item); the samples all usestring?, so copied code warns on nullability.
src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Dropdown/_BitDropdownCustomDemo.razor.samples.cs#L626-L628: change(string? text, Product item)to(string text, Product item)inexample9CsharpCode..../_BitDropdownCustomDemo.razor.samples.cs#L1153-L1155: same change inexample14CsharpCode..../_BitDropdownCustomDemo.razor.samples.cs#L1222-L1224: same change inexample15CsharpCode..../_BitDropdownCustomDemo.razor.samples.cs#L1342-L1344: same change inexample16CsharpCode..../_BitDropdownCustomDemo.razor.samples.cs#L1431-L1433: same change inexample17CsharpCode.🤖 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/Inputs/Dropdown/_BitDropdownCustomDemo.razor.samples.cs` around lines 626 - 628, Update the TextSetter lambda parameter type from nullable string? to non-nullable string in example9CsharpCode at src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Dropdown/_BitDropdownCustomDemo.razor.samples.cs:626-628, and apply the same change in example14CsharpCode at :1153-1155, example15CsharpCode at :1222-1224, example16CsharpCode at :1342-1344, and example17CsharpCode at :1431-1433. Keep the Product item parameter and setter behavior unchanged.
🤖 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/Inputs/Dropdown/BitDropdown.razor`:
- Around line 466-473: Keep the live-region container associated with
GetSearchResultsText permanently mounted in the dropdown markup, and
conditionally vary or clear only its text based on HasSearchText and IsLoading.
Preserve the existing polite, atomic status semantics while ensuring the element
remains in the accessibility tree before search-result announcements occur.
In `@src/BlazorUI/Bit.BlazorUI/Scripts/Dropdowns.ts`:
- Around line 116-122: Update the visibility filter in BitDropdowns._getItems to
remove the offsetParent check, which excludes valid position-fixed dropdown
items. Replace it with a robust visibility check using checkVisibility() or
nonzero getBoundingClientRect() dimensions while preserving the existing
disabled and excluded-container filters.
- Around line 85-170: Serialize virtualized focus operations per callout by
adding a generation token associated with each callout and incrementing it at
the start of focusItem. Capture the token before awaiting _scrollFor, then abort
the stale invocation if the token changes after the await, preventing outdated
calls from applying interleaved items, scrolling, or focus results.
In
`@src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Dropdown/_BitDropdownOptionDemo.razor.samples.cs`:
- Around line 488-512: Update the example9 sample declarations to include the
comboBoxItems collection referenced by the “Highlight in the ComboBox” markup,
matching the equivalent declarations in _BitDropdownItemDemo.razor.samples.cs
while retaining basicItems for the existing dropdown examples.
---
Nitpick comments:
In `@src/BlazorUI/Bit.BlazorUI/Components/Inputs/Dropdown/BitDropdown.razor.cs`:
- Around line 1744-1750: Update the OnSetIsOpen flow to await ClearComboBoxInput
instead of discarding its task, allowing the SearchVirtualized and
Virtualize.RefreshDataAsync work and exceptions to remain in the caller’s async
flow. Preserve the existing ordering so the combo input is cleared before
invoking OnOpen or OnClose.
In
`@src/BlazorUI/Bit.BlazorUI/Components/Inputs/Dropdown/BitDropdownSearchMode.cs`:
- Around line 20-23: Rename the BitDropdownSearchMode enum member Equals to a
non-conflicting match-mode name such as ExactMatch, and update all references to
the member accordingly. Preserve the existing exact text matching behavior while
avoiding shadowing object.Equals and establishing the corrected public API name
now.
In
`@src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Dropdown/_BitDropdownCustomDemo.razor.samples.cs`:
- Around line 626-628: Update the TextSetter lambda parameter type from nullable
string? to non-nullable string in example9CsharpCode at
src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Dropdown/_BitDropdownCustomDemo.razor.samples.cs:626-628,
and apply the same change in example14CsharpCode at :1153-1155,
example15CsharpCode at :1222-1224, example16CsharpCode at :1342-1344, and
example17CsharpCode at :1431-1433. Keep the Product item parameter and setter
behavior unchanged.
🪄 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 Plus
Run ID: 91a1b8ab-ff01-4c43-b4d6-289c5d006623
📒 Files selected for processing (21)
src/BlazorUI/Bit.BlazorUI/Components/Inputs/Dropdown/BitDropdown.razorsrc/BlazorUI/Bit.BlazorUI/Components/Inputs/Dropdown/BitDropdown.razor.cssrc/BlazorUI/Bit.BlazorUI/Components/Inputs/Dropdown/BitDropdown.scsssrc/BlazorUI/Bit.BlazorUI/Components/Inputs/Dropdown/BitDropdownClassStyles.cssrc/BlazorUI/Bit.BlazorUI/Components/Inputs/Dropdown/BitDropdownSearchMode.cssrc/BlazorUI/Bit.BlazorUI/Components/Inputs/Dropdown/_BitDropdownItem.razorsrc/BlazorUI/Bit.BlazorUI/Extensions/JsInterop/DropdownsJsRuntimeExtensions.cssrc/BlazorUI/Bit.BlazorUI/Scripts/Dropdowns.tssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Dropdown/BitDropdownDemo.razorsrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Dropdown/BitDropdownDemo.razor.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Dropdown/BitDropdownDemo.razor.scsssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Dropdown/_BitDropdownCustomDemo.razorsrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Dropdown/_BitDropdownCustomDemo.razor.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Dropdown/_BitDropdownCustomDemo.razor.samples.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Dropdown/_BitDropdownItemDemo.razorsrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Dropdown/_BitDropdownItemDemo.razor.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Dropdown/_BitDropdownItemDemo.razor.samples.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Dropdown/_BitDropdownOptionDemo.razorsrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Dropdown/_BitDropdownOptionDemo.razor.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Dropdown/_BitDropdownOptionDemo.razor.samples.cssrc/BlazorUI/Tests/Bit.BlazorUI.Tests/Components/Inputs/Dropdown/BitDropdownTests.cs
|
@coderabbitai full-review |
|
✅ Action performedFull review finished. |
…into 12741-blazorui-dropdown-improvements
There was a problem hiding this comment.
Actionable comments posted: 3
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/Inputs/Dropdown/_BitDropdownCustomDemo.razor.samples.cs (1)
659-702: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
example10CsharpCodeis missingcomboBoxNameSelectors.The razor snippet (line 658) binds
NameSelectors="comboBoxNameSelectors", but the C# sample only declaresnameSelectors, plus noProductclass is defined here either. Copying this example won't compile. Other combo samples (e.g.example9CsharpCode) declare both.🤖 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/Inputs/Dropdown/_BitDropdownCustomDemo.razor.samples.cs` around lines 659 - 702, Update the example10CsharpCode sample to declare comboBoxNameSelectors alongside nameSelectors, matching the NameSelectors binding in the razor snippet and the pattern used by example9CsharpCode. Ensure the sample also includes the Product model declaration required by these selector definitions so the copied example compiles.
🧹 Nitpick comments (3)
src/BlazorUI/Bit.BlazorUI/Components/Inputs/Dropdown/BitDropdown.razor.cs (1)
844-856: 🎯 Functional Correctness | 🔵 Trivial | 💤 Low value
IsMaxSelectedItemsReachedreadsValues, which can lag_selectedItemsin unbound scenarios.
AddOrRemoveSelectedItemassigns throughAssignValues, soValuesis normally in sync, but dynamically added combo items are pushed straight into_selectedItems. Consider deriving the count from_selectedItemsfor consistency with the chips/summary counters (GetDisplayedItemsCount).🤖 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/Inputs/Dropdown/BitDropdown.razor.cs` around lines 844 - 856, Update IsMaxSelectedItemsReached and its IsValuesCountAtLeast usage to derive the selected-item count from _selectedItems rather than Values, matching GetDisplayedItemsCount and keeping the limit check consistent for dynamically added combo items.src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Dropdown/_BitDropdownOptionDemo.razor (1)
1012-1022: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueMulti-select without any
Values/DefaultValuesbinding, unlike the sibling examples.Every other new multi-select sample here sets
DefaultValues(e.g.HideSelectedItemsat Line 1029,Item check iconat Line 1534), and the item-demo counterpart usesDefaultValues="@(Array.Empty<string>())"for this sameAutoClearSearchexample. Line 1506 (Chips remove icon (external)) has the same gap. Worth aligning so the demos start from a defined selection state.🤖 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/Inputs/Dropdown/_BitDropdownOptionDemo.razor` around lines 1012 - 1022, Update the AutoClearSearch BitDropdown sample to bind DefaultValues to an empty string array, matching the item-demo counterpart and sibling multi-select examples. Also apply the same explicit empty DefaultValues binding to the “Chips remove icon (external)” sample, while preserving their existing selection behavior.src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Dropdown/_BitDropdownItemDemo.razor.samples.cs (1)
1042-1047: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueEmpty/no-results/loading sample templates reference an undefined
custom-drp-emptyclass. The new templates reuseclass="custom-drp custom-drp-empty", but the only embedded<style>block in either samples file (example12) defines.custom-drpplus-lbl/-txt/-ph/-item/-header— never-empty. Copied as-is, the snippets render unstyled.
src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Dropdown/_BitDropdownItemDemo.razor.samples.cs#L1042-L1047: add a small<style>block defining.custom-drp-emptytoexample21RazorCode(and reuse it inexample22RazorCodeat Line 1114), or drop the class.src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Dropdown/_BitDropdownOptionDemo.razor.samples.cs#L1362-L1367: apply the same fix toexample21RazorCodeandexample22RazorCode(Line 1458).🤖 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/Inputs/Dropdown/_BitDropdownItemDemo.razor.samples.cs` around lines 1042 - 1047, Define styling for the custom-drp-empty class, or remove that class, so the empty/no-results/loading templates render correctly. In src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Dropdown/_BitDropdownItemDemo.razor.samples.cs:1042-1047, update example21RazorCode and reuse the fix in example22RazorCode around line 1114; apply the same change in _BitDropdownOptionDemo.razor.samples.cs:1362-1367 for example21RazorCode and around line 1458 for example22RazorCode.
🤖 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/Inputs/Dropdown/BitDropdown.razor.cs`:
- Around line 2110-2131: Invalidate the searched and display caches whenever the
ItemsProvider replaces _lastShownItems in the provider request flow. Update the
state after assigning providerResult.Items so _searchedItems, _displayItems, and
_itemPositions cannot be reused for the previous window, while preserving the
existing StateHasChanged and result-return behavior.
In
`@src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Dropdown/_BitDropdownCustomDemo.razor`:
- Around line 301-303: Update the dropdown search-mode prose to use the valid
BitDropdownSearchMode member ExactMatch instead of Equals in
_BitDropdownCustomDemo.razor lines 301-303 and _BitDropdownItemDemo.razor lines
299-301; leave the remaining mode descriptions unchanged.
In
`@src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Dropdown/BitDropdownDemo.razor.cs`:
- Around line 428-433: Update the OnDynamicAdd entry in the component reference
table to use EventCallback<TItem> instead of EventCallback<string>, matching
BitDropdown’s declaration and the Product callback usage in the demos.
---
Outside diff comments:
In
`@src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Dropdown/_BitDropdownCustomDemo.razor.samples.cs`:
- Around line 659-702: Update the example10CsharpCode sample to declare
comboBoxNameSelectors alongside nameSelectors, matching the NameSelectors
binding in the razor snippet and the pattern used by example9CsharpCode. Ensure
the sample also includes the Product model declaration required by these
selector definitions so the copied example compiles.
---
Nitpick comments:
In `@src/BlazorUI/Bit.BlazorUI/Components/Inputs/Dropdown/BitDropdown.razor.cs`:
- Around line 844-856: Update IsMaxSelectedItemsReached and its
IsValuesCountAtLeast usage to derive the selected-item count from _selectedItems
rather than Values, matching GetDisplayedItemsCount and keeping the limit check
consistent for dynamically added combo items.
In
`@src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Dropdown/_BitDropdownItemDemo.razor.samples.cs`:
- Around line 1042-1047: Define styling for the custom-drp-empty class, or
remove that class, so the empty/no-results/loading templates render correctly.
In
src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Dropdown/_BitDropdownItemDemo.razor.samples.cs:1042-1047,
update example21RazorCode and reuse the fix in example22RazorCode around line
1114; apply the same change in _BitDropdownOptionDemo.razor.samples.cs:1362-1367
for example21RazorCode and around line 1458 for example22RazorCode.
In
`@src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Dropdown/_BitDropdownOptionDemo.razor`:
- Around line 1012-1022: Update the AutoClearSearch BitDropdown sample to bind
DefaultValues to an empty string array, matching the item-demo counterpart and
sibling multi-select examples. Also apply the same explicit empty DefaultValues
binding to the “Chips remove icon (external)” sample, while preserving their
existing selection behavior.
🪄 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 Plus
Run ID: a25ae613-18cf-495e-a6cb-07aa77252c6f
📒 Files selected for processing (21)
src/BlazorUI/Bit.BlazorUI/Components/Inputs/Dropdown/BitDropdown.razorsrc/BlazorUI/Bit.BlazorUI/Components/Inputs/Dropdown/BitDropdown.razor.cssrc/BlazorUI/Bit.BlazorUI/Components/Inputs/Dropdown/BitDropdown.scsssrc/BlazorUI/Bit.BlazorUI/Components/Inputs/Dropdown/BitDropdownClassStyles.cssrc/BlazorUI/Bit.BlazorUI/Components/Inputs/Dropdown/BitDropdownSearchMode.cssrc/BlazorUI/Bit.BlazorUI/Components/Inputs/Dropdown/_BitDropdownItem.razorsrc/BlazorUI/Bit.BlazorUI/Extensions/JsInterop/DropdownsJsRuntimeExtensions.cssrc/BlazorUI/Bit.BlazorUI/Scripts/Dropdowns.tssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Dropdown/BitDropdownDemo.razorsrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Dropdown/BitDropdownDemo.razor.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Dropdown/BitDropdownDemo.razor.scsssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Dropdown/_BitDropdownCustomDemo.razorsrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Dropdown/_BitDropdownCustomDemo.razor.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Dropdown/_BitDropdownCustomDemo.razor.samples.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Dropdown/_BitDropdownItemDemo.razorsrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Dropdown/_BitDropdownItemDemo.razor.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Dropdown/_BitDropdownItemDemo.razor.samples.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Dropdown/_BitDropdownOptionDemo.razorsrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Dropdown/_BitDropdownOptionDemo.razor.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Dropdown/_BitDropdownOptionDemo.razor.samples.cssrc/BlazorUI/Tests/Bit.BlazorUI.Tests/Components/Inputs/Dropdown/BitDropdownTests.cs
|
@coderabbitai full-review |
|
✅ Action performedFull review finished. Your included review limit is currently reached under our Fair Usage Limits Policy. This review may still proceed through usage-based billing if eligible. Your next included review will be available in 11 seconds. |
…into 12741-blazorui-dropdown-improvements
closes #12741
Summary by CodeRabbit