Skip to content

Fix callout position issues in BitDateRangePicker (#8507)#12273

Merged
msynk merged 2 commits into
bitfoundation:developfrom
msynk:8507-daterangepicker-callout-position-issues
Apr 25, 2026
Merged

Fix callout position issues in BitDateRangePicker (#8507)#12273
msynk merged 2 commits into
bitfoundation:developfrom
msynk:8507-daterangepicker-callout-position-issues

Conversation

@msynk
Copy link
Copy Markdown
Member

@msynk msynk commented Apr 25, 2026

closes #8507

Summary by CodeRabbit

  • Bug Fixes
    • DatePicker: Month and year navigation now properly respect disabled state.
    • DateRangePicker: Readonly state is now consistently enforced across input clearing and focus interactions.
    • DateRangePicker: Improved responsiveness when interacting with the date picker callout.
    • DateRangePicker: Enhanced text input change handling with better value synchronization.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 25, 2026

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: d07e6704-1f02-4076-9c0b-530e11e11186

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Walkthrough

The 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

Cohort / File(s) Summary
BitDatePicker refinements
src/BlazorUI/Bit.BlazorUI/Components/Inputs/DatePicker/BitDatePicker.razor.cs
Converted RootElementClass to expression-bodied read-only property, relocated and reintroduced HandleGoToNow async method, added explicit IsEnabled checks to CanChangeMonth and CanChangeYear for early disabled-state validation.
BitDateRangePicker enhancements
src/BlazorUI/Bit.BlazorUI/Components/Inputs/DateRangePicker/BitDateRangePicker.razor.cs
Updated styling class selection to use fixed "bit-dtrp-..." class names; added StateHasChanged call before callout toggle; enhanced text-input change handling with CurrentValueAsString initialization and _currentYear synchronization; added ReadOnly checks to clearing and focus handlers; improved month selection overlay behavior with ShowTimePicker condition.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 Two date-pickers now dance with grace,
Disabled checks find their proper place,
RTL callouts sit just right,
State syncs flow, from day to night,
Month and year both bow to might!

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Title check ⚠️ Warning The PR title references fixing callout position issues in BitDateRangePicker, which aligns with the issue #8507 objective. However, the actual changes in the raw summary show modifications to both BitDatePicker and BitDateRangePicker, with multiple unrelated refactorings (property conversion, method relocation, button state checks) beyond callout positioning fixes. Review whether the non-callout-related changes (RootElementClass conversion, HandleGoToNow relocation, CanChangeMonth/CanChangeYear logic) are necessary for fixing the callout position issue, or separate them into distinct PRs with appropriate titles.
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 (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ 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

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between c37c6f4 and f7b522e.

📒 Files selected for processing (2)
  • src/BlazorUI/Bit.BlazorUI/Components/Inputs/DatePicker/BitDatePicker.razor.cs
  • src/BlazorUI/Bit.BlazorUI/Components/Inputs/DateRangePicker/BitDateRangePicker.razor.cs

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 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 BitDateRangePicker internal state updates around opening/toggling the callout and month picker overlay behavior when ShowTimePicker is enabled.
  • Adjusted BitDateRangePicker change/clear/focus handlers to better respect ReadOnly and 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.

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

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

@msynk msynk merged commit 7212f65 into bitfoundation:develop Apr 25, 2026
7 checks passed
@msynk msynk deleted the 8507-daterangepicker-callout-position-issues branch April 25, 2026 13:53
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.

Incorrect callout position in BitDateRangePicker with ShowTimePicker enabled and RTL direction

3 participants