Skip to content

Apply BitTimePicker improvements (#12873) - #12877

Open
msynk wants to merge 5 commits into
bitfoundation:developfrom
msynk:12873-blazorui-timepicker-improvements
Open

Apply BitTimePicker improvements (#12873)#12877
msynk wants to merge 5 commits into
bitfoundation:developfrom
msynk:12873-blazorui-timepicker-improvements

Conversation

@msynk

@msynk msynk commented Aug 10, 2026

Copy link
Copy Markdown
Member

closes #12873

Summary by CodeRabbit

  • New Features
    • Added optional seconds selection with configurable steps, labels, icons, and visibility.
    • Added minimum and maximum time limits plus allowed-value rules.
    • Added Now and Clear actions, configurable buttons, and improved AM/PM controls.
    • Added keyboard navigation, continuous spinning, responsive interactions, and focus restoration.
  • Accessibility & Usability
    • Improved labels, ARIA metadata, read-only behavior, focus indicators, and tab order.
    • Enhanced validation, text input handling, and callout open/close behavior.
  • Documentation
    • Expanded demos and examples covering new options, accessibility, validation, responsive layouts, events, styling, and RTL.

Greptile Summary

The PR substantially expands BitTimePicker with seconds, time constraints, allowed-value predicates, action buttons, keyboard interaction, accessibility improvements, and additional customization.

  • Adds optional seconds and configurable stepping for each time unit.
  • Adds minimum/maximum limits, allowed-value predicates, and updated parsing and validation.
  • Adds Now, Clear, open/close callbacks, keyboard navigation, focus management, and responsive interactions.
  • Expands component demos, styling hooks, and test coverage.

Confidence Score: 4/5

The PR does not yet appear safe to merge because the previously reported event-handler wrapping defect remains outstanding.

The current TimePicker markup still directly binds the newly added interaction handlers, including paths that invoke consumer callbacks and predicates, so exceptions can bypass the project-required event-handling wrapper.

Files Needing Attention: src/BlazorUI/Bit.BlazorUI/Components/Inputs/TimePicker/BitTimePicker.razor

Important Files Changed

Filename Overview
src/BlazorUI/Bit.BlazorUI/Components/Inputs/TimePicker/BitTimePicker.razor Expands the picker markup with seconds, spin controls, actions, keyboard events, and accessibility metadata.
src/BlazorUI/Bit.BlazorUI/Components/Inputs/TimePicker/BitTimePicker.razor.cs Implements constraints, allowed-value selection, lifecycle handling, focus restoration, keyboard behavior, and new public parameters and callbacks.
src/BlazorUI/Bit.BlazorUI/Components/Inputs/TimePicker/BitTimePicker.scss Updates TimePicker presentation for the expanded controls, responsive behavior, and interaction states.
src/BlazorUI/Tests/Bit.BlazorUI.Tests/Components/Inputs/TimePicker/BitTimePickerTests.cs Broadens coverage for the TimePicker’s new value, constraint, action, accessibility, and interaction behavior.
src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/TimePicker/BitTimePickerDemo.razor Adds demonstrations for the expanded TimePicker API and interaction modes.

Reviews (4): Last reviewed commit: "Merge branch 'develop' of https://github..." | Re-trigger Greptile

@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

BitTimePicker now supports seconds, constrained and stepped values, keyboard and pointer interaction, improved accessibility, callout lifecycle events, Now/Clear actions, responsive behavior, expanded styling hooks, comprehensive demos, and validation coverage.

Changes

TimePicker improvements

Layer / File(s) Summary
Component contracts and rendered controls
src/BlazorUI/Bit.BlazorUI/Components/Inputs/TimePicker/BitTimePicker.razor, src/BlazorUI/Bit.BlazorUI/Components/Inputs/TimePicker/BitTimePicker.razor.cs
Adds seconds, bounds, allowed-value predicates, labels, icons, action buttons, lifecycle callbacks, and accessibility metadata.
Selection and callout interaction
src/BlazorUI/Bit.BlazorUI/Components/Inputs/TimePicker/BitTimePicker.razor, src/BlazorUI/Bit.BlazorUI/Components/Inputs/TimePicker/BitTimePicker.razor.cs
Centralizes parsing, stepping, clamping, focus, keyboard handling, open-state synchronization, and swipe cleanup.
Visual states and style hooks
src/BlazorUI/Bit.BlazorUI/Components/Inputs/TimePicker/BitTimePicker.scss, src/BlazorUI/Bit.BlazorUI/Components/Inputs/TimePicker/BitTimePickerClassStyles.cs
Adds focus styling, action-button states, responsive layout updates, logical close-button positioning, and seconds/action class hooks.
Demo coverage and documentation
src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/TimePicker/*
Adds examples and metadata for the new selection, accessibility, validation, event, styling, responsive, icon, and RTL behavior.
Component behavior validation
src/BlazorUI/Tests/Bit.BlazorUI.Tests/Components/Inputs/TimePicker/*
Adds coverage for formatting, input, stepping, constraints, actions, read-only behavior, focus, lifecycle events, and form validation.

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  actor User
  participant BitTimePicker
  participant TimePickerCallout
  participant JSGestures
  User->>BitTimePicker: Press key or pointer control
  BitTimePicker->>TimePickerCallout: Open or update picker
  TimePickerCallout->>BitTimePicker: Return time or action change
  BitTimePicker->>JSGestures: Configure or release swipe handling
  BitTimePicker-->>User: Render value and focus state
Loading

Suggested reviewers: yasmoradi, cyrus-sushiant, mhrastegari

Poem

I’m a rabbit with seconds to spare,
Spinning time through the cool evening air.
Bounds snap in place,
Focus finds its space,
Now and Clear buttons wait there.

🚥 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
Linked Issues check ✅ Passed The changes implement BitTimePicker features and expand, document, and test the related demo examples required by issue [#12873].
Out of Scope Changes check ✅ Passed The component, demo, styling, and test changes are directly related to the objectives in issue [#12873].
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: applying BitTimePicker improvements tracked by issue #12873.
✨ 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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/BlazorUI/Bit.BlazorUI/Components/Inputs/TimePicker/BitTimePicker.razor.cs (1)

628-638: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Add ResetStyleBuilder to IsOpen. The source generator resets StyleBuilder for parameters with this attribute. Without it, Styles.Focused can remain stale when IsOpen changes.

🤖 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/TimePicker/BitTimePicker.razor.cs`
around lines 628 - 638, Update the IsOpen parameter declaration in BitTimePicker
to include the ResetStyleBuilder attribute, ensuring StyleBuilder is reset
whenever IsOpen changes. Preserve the existing RegisterCssStyles implementation
and style registrations.
🧹 Nitpick comments (3)
src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/TimePicker/BitTimePickerDemo.razor (1)

421-421: 🔒 Security & Privacy | 🔵 Trivial | ⚡ Quick win

Add SRI to both external icon stylesheets.

Add crossorigin="anonymous" and these integrity values to all four links. Keep the rendered links and copyable sample identical.

  • Font Awesome: sha384-rWj9FmWWt3OMqd9vBkWRhFavvVUYalYqGPoMdL1brs/qvvqz88gvLShYa4hKNyqb
  • Bootstrap Icons: sha384-XGjxtQfXaH2tnPFa9x+ruJTuLE3Aa6LhHSWRr1XeTyhezb4abCG4ccI5AkVDxqC+
🤖 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/TimePicker/BitTimePickerDemo.razor`
at line 421, Add SRI attributes to both external icon stylesheet links in
BitTimePickerDemo.razor at lines 421-421 and the corresponding copyable sample
in BitTimePickerDemo.razor.samples.cs at lines 256-278: add
crossorigin="anonymous" and the specified Font Awesome or Bootstrap Icons
integrity value to all four links, while keeping their rendered URLs and sample
contents identical.
src/BlazorUI/Bit.BlazorUI/Components/Inputs/TimePicker/BitTimePicker.scss (1)

60-61: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Remove the empty &.bit-rtl block.

The RTL close-button rule moved to inset-inline-end, so this selector has no declarations left.

♻️ Proposed cleanup
-
-    &.bit-rtl {
-    }
 }
🤖 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/TimePicker/BitTimePicker.scss`
around lines 60 - 61, Remove the empty &.bit-rtl selector block from the
BitTimePicker styles, leaving the existing inset-inline-end RTL close-button
rule unchanged.
src/BlazorUI/Tests/Bit.BlazorUI.Tests/Components/Inputs/TimePicker/BitTimePickerTests.cs (1)

513-531: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Make the press-and-hold test able to fail.

downTask completes only after the continuous loop is cancelled. Task.WhenAny(downTask, Task.Delay(5000)) therefore returns even when the loop never stops, and the assertion value >= new TimeSpan(11, 30, 0) is already satisfied by the single step that HandleOnPointerDown performs before the hold starts. A regression in the release path keeps this test green and adds a five-second wait.

Await downTask directly with a timeout that fails the test, then assert that the value stops changing after the release.

💚 Proposed test change
-        var downTask = button.TriggerEventAsync("onpointerdown", new PointerEventArgs());
-
-        await button.TriggerEventAsync("onpointerup", new PointerEventArgs());
-
-        await Task.WhenAny(downTask, Task.Delay(5000));
-
-        Assert.IsTrue(value >= new TimeSpan(11, 30, 0));
+        var downTask = button.TriggerEventAsync("onpointerdown", new PointerEventArgs());
+
+        await button.TriggerEventAsync("onpointerup", new PointerEventArgs());
+
+        var completed = await Task.WhenAny(downTask, Task.Delay(5000));
+        Assert.AreSame(downTask, completed, "the press-and-hold loop did not stop on release");
+
+        var afterRelease = value;
+        Assert.IsTrue(afterRelease >= new TimeSpan(11, 30, 0));
+
+        await Task.Delay(300);
+        Assert.AreEqual(afterRelease, value, "the value kept changing after the release");
🤖 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/Tests/Bit.BlazorUI.Tests/Components/Inputs/TimePicker/BitTimePickerTests.cs`
around lines 513 - 531, Update
BitTimePickerShouldStepWithAPointerPressAndStopOnRelease to await downTask with
a timeout that fails the test if the pointer-down loop does not terminate,
instead of using Task.WhenAny. After release and completion, verify the value no
longer changes, ensuring the release path actually stops continuous stepping.
🤖 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.

Outside diff comments:
In
`@src/BlazorUI/Bit.BlazorUI/Components/Inputs/TimePicker/BitTimePicker.razor.cs`:
- Around line 628-638: Update the IsOpen parameter declaration in BitTimePicker
to include the ResetStyleBuilder attribute, ensuring StyleBuilder is reset
whenever IsOpen changes. Preserve the existing RegisterCssStyles implementation
and style registrations.

---

Nitpick comments:
In `@src/BlazorUI/Bit.BlazorUI/Components/Inputs/TimePicker/BitTimePicker.scss`:
- Around line 60-61: Remove the empty &.bit-rtl selector block from the
BitTimePicker styles, leaving the existing inset-inline-end RTL close-button
rule unchanged.

In
`@src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/TimePicker/BitTimePickerDemo.razor`:
- Line 421: Add SRI attributes to both external icon stylesheet links in
BitTimePickerDemo.razor at lines 421-421 and the corresponding copyable sample
in BitTimePickerDemo.razor.samples.cs at lines 256-278: add
crossorigin="anonymous" and the specified Font Awesome or Bootstrap Icons
integrity value to all four links, while keeping their rendered URLs and sample
contents identical.

In
`@src/BlazorUI/Tests/Bit.BlazorUI.Tests/Components/Inputs/TimePicker/BitTimePickerTests.cs`:
- Around line 513-531: Update
BitTimePickerShouldStepWithAPointerPressAndStopOnRelease to await downTask with
a timeout that fails the test if the pointer-down loop does not terminate,
instead of using Task.WhenAny. After release and completion, verify the value no
longer changes, ensuring the release path actually stops continuous stepping.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 33d4c862-e9b5-48de-857a-1b86db749c41

📥 Commits

Reviewing files that changed from the base of the PR and between 5091172 and 317e1ec.

📒 Files selected for processing (11)
  • src/BlazorUI/Bit.BlazorUI/Components/Inputs/TimePicker/BitTimePicker.razor
  • src/BlazorUI/Bit.BlazorUI/Components/Inputs/TimePicker/BitTimePicker.razor.cs
  • src/BlazorUI/Bit.BlazorUI/Components/Inputs/TimePicker/BitTimePicker.scss
  • src/BlazorUI/Bit.BlazorUI/Components/Inputs/TimePicker/BitTimePickerClassStyles.cs
  • src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/TimePicker/BitTimePickerDemo.razor
  • src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/TimePicker/BitTimePickerDemo.razor.cs
  • src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/TimePicker/BitTimePickerDemo.razor.samples.cs
  • src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/TimePicker/BitTimePickerDemo.razor.scss
  • src/BlazorUI/Tests/Bit.BlazorUI.Tests/Components/Inputs/TimePicker/BitTimePickerTestModel.cs
  • src/BlazorUI/Tests/Bit.BlazorUI.Tests/Components/Inputs/TimePicker/BitTimePickerTests.cs
  • src/BlazorUI/Tests/Bit.BlazorUI.Tests/Components/Inputs/TimePicker/BitTimePickerValidationTest.razor

…into 12873-blazorui-timepicker-improvements
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 BitTimePicker improvements

1 participant