Fix callout position issues in BitDateRangePicker (#8507)#12273
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 Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
WalkthroughThe pull request refines two DatePicker components: BitDatePicker and BitDateRangePicker. Changes include property restructuring, enhanced disabled-state validation checks, improved state management in event handlers, CSS class updates, and method reorganization to better handle user interactions and RTL scenarios. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (1 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 the current code and only fix it if needed.
Inline comments:
In
`@src/BlazorUI/Bit.BlazorUI/Components/Inputs/DateRangePicker/BitDateRangePicker.razor.cs`:
- Around line 956-979: The branch that updates the calendar year reacts to
either start or end year changes but unconditionally sets _currentYear from
curStartValue.Year; change the logic in the IsOpen block so the year-navigation
only updates when the start year actually changed: keep the outer
change-detection (oldStartValue != curStartValue || oldEndValue != curEndValue)
but replace the inner condition to check curStartValue.Year !=
oldStartValue.Year before assigning _currentYear and calling ChangeYearRanges;
use the existing symbols (CurrentValue, CurrentValueAsString, IsOpen,
oldStartValue, oldEndValue, curStartValue, curEndValue, _currentYear,
CheckCurrentCalendarMatchesCurrentValue, ChangeYearRanges) to locate and apply
the fix.
🪄 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: b3909cce-8293-4cef-899a-64911faaad07
📒 Files selected for processing (2)
src/BlazorUI/Bit.BlazorUI/Components/Inputs/DatePicker/BitDatePicker.razor.cssrc/BlazorUI/Bit.BlazorUI/Components/Inputs/DateRangePicker/BitDateRangePicker.razor.cs
There was a problem hiding this comment.
Pull request overview
This PR addresses a UI positioning issue in BitDateRangePicker where the callout opens in the wrong place when ShowTimePicker is enabled in RTL layouts, improving the component’s runtime state sync before the callout is toggled.
Changes:
- Updated
BitDateRangePickerinternal state updates around opening/toggling the callout and month picker overlay behavior whenShowTimePickeris enabled. - Adjusted
BitDateRangePickerchange/clear/focus handlers to better respectReadOnlyand keep calendar state aligned with value changes. - Minor internal refactors in
BitDatePicker(root class property style, method placement, and disabled-state checks for navigation).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/BlazorUI/Bit.BlazorUI/Components/Inputs/DateRangePicker/BitDateRangePicker.razor.cs | Callout/opening state adjustments for RTL + time picker scenarios; updates to change handling and read-only guards. |
| src/BlazorUI/Bit.BlazorUI/Components/Inputs/DatePicker/BitDatePicker.razor.cs | Small internal refactor + ensures month/year navigation correctly returns disabled when the component is disabled. |
closes #8507
Summary by CodeRabbit