Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Windows] Fix for SearchHandler.Focused and Unfocused event never fires #27577

Merged
merged 4 commits into from
Feb 12, 2025

Conversation

BagavathiPerumal
Copy link
Contributor

Root cause

The root cause of the issue is that the GotFocus and LostFocus events for the AutoSuggestBox control were not previously integrated with the SearchHandler's SetIsFocused method. As a result, the Focused and Unfocused events for the Shell.SearchHandler were not being triggered when the search handler gained or lost focus, leading to incorrect focus management behavior.

Description of Issue Fix

The fix involves connecting the GotFocus and LostFocus events of the AutoSuggestBox control to the SearchHandler's focus management. This is done by adding event handlers for these events in the UpdateSearchHandler method, which will call the SetIsFocused method when the AutoSuggestBox gains or loses focus. This ensures that the Focused and Unfocused events are triggered properly, allowing the search handler to respond when focus changes.

Tested the behavior in the following platforms.

  • Windows
  • Android
  • iOS
  • Mac

Issues Fixed

Fixes #27551

Output

Before Issue Fix After Issue Fix
SearchHandler-BeforeFix.mp4
SearchHandler-AfterFix.mp4

@dotnet-policy-service dotnet-policy-service bot added the community ✨ Community Contribution label Feb 5, 2025
Copy link
Contributor

Hey there @BagavathiPerumal! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed.

@BagavathiPerumal
Copy link
Contributor Author

@dotnet-policy-service terminate

@karthikraja-arumugam karthikraja-arumugam added the partner/syncfusion Issues / PR's with Syncfusion collaboration label Feb 5, 2025
@BagavathiPerumal
Copy link
Contributor Author

@dotnet-policy-service agree company="Syncfusion, Inc."

@@ -275,6 +275,8 @@ void UpdateSearchHandler()
autoSuggestBox.TextChanged += OnSearchBoxTextChanged;
autoSuggestBox.QuerySubmitted += OnSearchBoxQuerySubmitted;
autoSuggestBox.SuggestionChosen += OnSearchBoxSuggestionChosen;
autoSuggestBox.GotFocus += OnSearchBoxGotFocus;
Copy link
Contributor

Choose a reason for hiding this comment

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

Where do we unsubscribe from these events?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jsuarezruiz, The events are unsubscribed in the DisconnectHandler of ShellItemHandler. Please let me know if you have any other concerns.

@BagavathiPerumal BagavathiPerumal marked this pull request as ready for review February 7, 2025 04:35
@BagavathiPerumal BagavathiPerumal requested a review from a team as a code owner February 7, 2025 04:35
@mattleibow
Copy link
Member

/azp run

Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@PureWeen
Copy link
Member

/azp run

@PureWeen PureWeen added this to the .NET 9 SR5 milestone Feb 10, 2025
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@rmarinho rmarinho merged commit 771462d into dotnet:main Feb 12, 2025
119 of 123 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community ✨ Community Contribution partner/syncfusion Issues / PR's with Syncfusion collaboration
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

[Windows] SearchHandler.Focused and Unfocused event never fires
6 participants