Skip to content

Utilize ReadOnly parameter in BitDropdown (#12257)#12258

Merged
msynk merged 1 commit intobitfoundation:developfrom
msynk:12257-blazorui-dropdown-readonly
Apr 15, 2026
Merged

Utilize ReadOnly parameter in BitDropdown (#12257)#12258
msynk merged 1 commit intobitfoundation:developfrom
msynk:12257-blazorui-dropdown-readonly

Conversation

@msynk
Copy link
Copy Markdown
Member

@msynk msynk commented Apr 15, 2026

closes #12257

Summary by CodeRabbit

  • Bug Fixes
    • Fixed dropdown component to properly respect read-only state across all user interactions, preventing selection changes, clearing, and dynamic item additions when read-only is enabled.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 15, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 5e2dcddc-50d9-44b5-9a90-8c364cb385aa

📥 Commits

Reviewing files that changed from the base of the PR and between ada36f4 and 8af0ede.

📒 Files selected for processing (1)
  • src/BlazorUI/Bit.BlazorUI/Components/Inputs/Dropdown/BitDropdown.razor.cs

Walkthrough

The BitDropdown<TItem, TValue> component now properly enforces the ReadOnly parameter by adding validation guards across eight user interaction methods. These guards prevent selection changes, clearing operations, dynamic item additions, and combo input updates when the dropdown is in read-only mode.

Changes

Cohort / File(s) Summary
ReadOnly Parameter Implementation
src/BlazorUI/Bit.BlazorUI/Components/Inputs/Dropdown/BitDropdown.razor.cs
Added ReadOnly early-return checks to HandleOnItemClick, AddOrRemoveSelectedItem, ClearComboBoxInput, HandleOnClearClick, HandleOnAddItemComboClick, HandleOnComboInput, RemoveLastSelectedItem, and AddDynamicItem methods. Additionally enhanced AddOrRemoveSelectedItem to return early when IsEnabled is false.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 A ReadOnly guardian hops into place,
Eight paths now guarded with graceful embrace,
No selections slip through, no items take flight,
When read-only's engaged, the dropdown stands tight!
The parameter works at last—hooray for the light!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: adding ReadOnly parameter utilization to BitDropdown component.
Linked Issues check ✅ Passed The pull request successfully implements ReadOnly parameter guards across all user interaction paths in BitDropdown, directly addressing issue #12257's requirement to utilize ReadOnly from BitInputBase.
Out of Scope Changes check ✅ Passed All changes are focused on adding ReadOnly guards to BitDropdown interaction methods, which is within scope of issue #12257 and the PR objectives.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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 addresses issue #12257 by wiring the inherited ReadOnly behavior into BitDropdown so user interactions no longer modify selection/value when the component is read-only.

Changes:

  • Added ReadOnly guards to selection-changing handlers (item click, clear, dynamic add, combo input, backspace removal).
  • Added ReadOnly guards to internal selection mutation methods to prevent value changes from user-driven flows.

@msynk msynk merged commit 81f2109 into bitfoundation:develop Apr 15, 2026
7 checks passed
@msynk msynk deleted the 12257-blazorui-dropdown-readonly branch April 15, 2026 10:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The ReadOnly parameter is not working properly in the BitDropdown component

2 participants