Skip to content

bek-FLOR-1914: Add ConfirmOnLoseFocus support for components lacking …#18

Open
bek-bsw wants to merge 2 commits intomasterfrom
bek-FLOR-1914
Open

bek-FLOR-1914: Add ConfirmOnLoseFocus support for components lacking …#18
bek-bsw wants to merge 2 commits intomasterfrom
bek-FLOR-1914

Conversation

@bek-bsw
Copy link
Copy Markdown
Contributor

@bek-bsw bek-bsw commented Dec 10, 2025

…focusout

@bek-bsw bek-bsw requested a review from Copilot December 10, 2025 11:23
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 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 ConfirmOnLoseFocus and EditView to child components
  • Implemented automatic confirmation in Combobox when a selection is made and ConfirmOnLoseFocus is enabled
  • Added a demonstration example showing Combobox working with ConfirmOnLoseFocus in 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.

@bek-bsw bek-bsw requested a review from Copilot December 10, 2025 16:00
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 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);
Copy link

Copilot AI Dec 10, 2025

Choose a reason for hiding this comment

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

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.

Copilot uses AI. Check for mistakes.
Comment on lines +59 to +64
_isManuallyConfirming = true;
await OnConfirm.InvokeAsync();

await Task.Delay(500);

_isManuallyConfirming = false;
Copy link

Copilot AI Dec 10, 2025

Choose a reason for hiding this comment

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

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.

Copilot uses AI. Check for mistakes.
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.

2 participants