Skip to content

Conversation

@MarvinKlein1508
Copy link
Collaborator

Pull Request

📖 Description

This PR fixes an issue with the FocusAsync method within the FluentDatePicker and FluentTimePicker components.

Both components inherit from FluentInputBase<T> but don't assign any reference to the actual Element property. This PR mainly does two things to fix this.

  1. Make the FocusAsync method from the FluentInputBase overwritable by adding virtual to the method signature
  2. Assign missing @ref for both components

Since the FluentDatePicker uses the FluentTextField component internally it overwrites the FocusAsync method and passes it down to the actual component.

🎫 Issues

Fixes: #4166

👩‍💻 Reviewer Notes

The missing behaviour can be reproduced with this code in the IssueTester

<FluentDatePicker @ref="_datePicker" @bind-Value="_dateTime" Label="Date picker"></FluentDatePicker>
<FluentTimePicker @ref="_timePicker" @bind-Value="_Time" Label="Time picker"></FluentTimePicker>

<FluentButton OnClick="@(() => _datePicker.FocusAsync())">Focus Date picker</FluentButton>
<FluentButton OnClick="@(() => _timePicker.FocusAsync())">Focus Time picker</FluentButton>

@code {
    FluentDatePicker _datePicker = null!;
    FluentTimePicker _timePicker = null!;
    private DateTime? _dateTime = DateTime.Now;
    private DateTime? _Time = DateTime.Now;
}

📑 Test Plan

✅ Checklist

General

  • I have added tests for my changes.
  • I have tested my changes.
  • I have updated the project documentation to reflect my changes.
  • I have read the CONTRIBUTING documentation and followed the standards for this project.

Component-specific

  • I have added a new component
  • I have added Unit Tests for my new component
  • I have modified an existing component
  • I have validated the Unit Tests for an existing component

⏭ Next Steps

@vnbaaij vnbaaij added this to the v4.12.2 milestone Sep 26, 2025
@vnbaaij vnbaaij enabled auto-merge (squash) September 26, 2025 14:46
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.

fix: FocusAsync() method throws exception in FluentDatePicker

2 participants