bek-FLOR-1914: Add ConfirmOnLoseFocus support for components lacking …#18
bek-FLOR-1914: Add ConfirmOnLoseFocus support for components lacking …#18
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds support for ConfirmOnLoseFocus functionality to the Combobox component, enabling it to automatically confirm inline edits when a selection is made. Previously, components lacking native focusout events (like Combobox) could not leverage this feature.
Key Changes:
- Extended the cascading parameter infrastructure to propagate
ConfirmOnLoseFocusandEditViewto child components - Implemented automatic confirmation in Combobox when a selection is made and
ConfirmOnLoseFocusis enabled - Added a demonstration example showing Combobox working with
ConfirmOnLoseFocusin InlineEdit
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| BlueBlazor/Internals/InlineEditParts/EditView.razor | Wraps form in CascadingValue to expose EditView instance to descendants |
| BlueBlazor/Components/InlineEdit/InlineEdit.razor | Adds cascading ConfirmOnLoseFocus parameter for child components |
| BlueBlazor/Components/Combobox/Combobox.razor.cs | Implements EditView integration and auto-confirmation on selection |
| BlueBlazor.Docs/Stories/InlineEdit/ConfirmOnLoseFocus.razor | Adds example demonstrating Combobox with ConfirmOnLoseFocus |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| _isManuallyConfirming = true; | ||
| await OnConfirm.InvokeAsync(); | ||
|
|
||
| await Task.Delay(500); |
There was a problem hiding this comment.
The 500ms delay is a magic number without explanation. Consider extracting this as a named constant with a comment explaining why this specific duration is needed to prevent race conditions between manual confirmation and focus loss events.
| _isManuallyConfirming = true; | ||
| await OnConfirm.InvokeAsync(); | ||
|
|
||
| await Task.Delay(500); | ||
|
|
||
| _isManuallyConfirming = false; |
There was a problem hiding this comment.
If ConfirmManually is called multiple times concurrently, the flag could be reset prematurely. Consider using a counter or ensuring mutual exclusion to handle overlapping calls correctly.
…focusout